Sleep Use Examples
Basic Example of Sleep
In this example, we are using a button process to get a random number from the GetRandomNumber service. But we are using sleep service to display the pop-up box after a certain amount of pause.
When we click the button the process first generates a random number then goes in a pause state for the specified amount of time. And then when the pause time is over it will display the random number in the pop-up box.
Here are the inputs for the sleep service and the logs running for it:
Using Sleep to Pause BSFN Service
In this example, “Two Way Matching” Process is called and the output should return details like document number and batch number of the particular invoice.
In this part of process, we are calling three Business Functions (BSFNs) to the desired output.
When the three BSFNs return, the process checks if any of those were timed out. This can happen sometimes when the server is busy/down or it takes more time then expected to return the results.
We are using sleep in this scenario to make sure we are waiting/pausing before we resend the request to BSFN. Resending it immediately would cause more trouble if the server is already busy/down.
Be aware that in this use example and when looping back on the process it is possible to create an infinite loop. For instance, if the BSFN continuously timed out, the process would keep trying until it received a different error.