Asynchronous web services usually take a long time to return a response and as such, a BPEL process service component must be able to time out, or give up waiting, and continue with the rest of the flow after a certain amount of time. You can use the pick activity to configure a BPEL flow either to wait over a specified amount of time or to continue performing its duties. To set an expiration period for the time, you can use the wait activity. To manage message, events can be used particularly when the business process is waiting for callbacks from partner Web services.
BPEL supports two types of events −
These events are triggered by incoming messages through operation invocation on port types.
These events are time-related and are triggered either after a certain duration or at a specific time.
Often, however, it is more useful to wait for more than one message, of which only one will occur.
Alarm events are useful when you want the process to wait for a callback for a certain period of time, such as 15 minutes.
If no callback is received, the process flow continues as designed.
Useful in loosely coupled service-oriented architectures, where you cannot rely on Web services being available all the time.
The pick activity has 2 branches −
onMessage − the code on this branch is equal to the code for receiving a response before a timeout was added.
onAlarm − this condition has code for a timeout of one minute.
The wait activity allows a process to wait for a given time period or until a time limit has been reached. Exactly one of the expiration criteria must be specified.