Pick
The Pick activity waits for the occurrence of exactly one event from a set of events, and then executes the activity associated with that event. After an event is selected, the Pick will no longer accept other events. The Pick activity is a good choice for asynchronous activities and lets you select one of a number of alternate paths. When the selected event is finished the Pick completes.
The Pick activity’s two events are:
- onMessage — The onMessage is similar to the Receive activity. It waits until an inbound message is received. Each Pick activity must include at least one onMessage event.
- onAlarm — The onAlarm corresponds to a timer-based alarm. If the value specified in \<for> is zero or negative, or the deadline specified in
<until>
has already been reached or passed, then the onAlarm event immediately executes.
The Pick activity blocks the process and waits until one of the events occurs. After the event occurs, the associated activity is performed. Events cannot occur at the same time, But if more than one event occurs then the activity associated with the event that occurred first is performed.
If it is configured to do so, the Pick can create a new process instance when the message is received, otherwise you must use correlation to locate an existing process instance.
To add a Pick activity:
-
From the Palette, drag a Pick activity to the BPEL Editor canvas.
An onMessage is automatically added to the Pick.
-
In the Properties view, select the partner link, operation, and variable for the onMessage.
- From the Palette, drag an activity, such a Receive, to the onMessage, and select activity properties to reflect the actions to take when the message arrives.
To add an onAlarm branch to a Pick activity:
- With the Pick selected, right-click and select Add onAlarm. An onAlarm element is added to the Pick activity.
- In the Properties view, select an Alarm Type: Wait Until-Fixed date and time, Wait Until-Date expression, Wait For-Fixed duration, or Wait For-Duration expression.
- Specify the date and time using the drop down lists.
- Drag an activity, such an Empty, to the onAlarm in the BPEL Editor, and select activity properties to reflect the actions to take when the alarm goes off.
More Information