Pick
BPMN Implementation: Event-based gateway
The Pick activity has at least one message or message part and can optionally contain one or more alarms. When the Pick executes, it blocks until one of its messages is received or until one of its alarms go off. Only a single message or alarm ever executes in a Pick since the receipt of the message or the firing of the alarm immediately causes all of the other branches to go dead.
For example, a service can implement the process of waiting for a response to a quote by using a Pick with an accept message, reject message, and a timeout. If the accept or reject message is not received within the timeout period, the alarm activity executes.
A Pick activity is a good choice for asynchronous activities.
You can also use a Pick activity to start a process with a set of messages and no alarm. This special form of Pick sets the Create Instance property to Yes and executes when the first message arrives.
Required Properties | Optional Properties |
---|
For onMessage: Partner Link Operation Variable or From Part | Create Instance Correlations. Correlation |
|
|
For onAlarm: Alarm Expression Alarm Type | |
|
To build an onAlarm branch of a Pick
- 1. From the Gateway palette, drag an Event-based gateway activity to the Process Editor canvas.
- 2. Select the onAlarm branch.
- 3. In the Properties view, select an Alarm Type: Duration or Deadline.
- 4. Click the Dialog (...) Button next to Alarm Expression.
- 5. In the Expression box, specify one of the following:
- a. For a deadline, enter an xsd:datetime expression, such as '2010-12-12T12:00'
- b. For a duration, enter an xsd:duration expression, such as 'PT1S'
- c. For details and examples, see Deadline and Duration Expressions
- 6. Drag an activity, such as a start, end, or none, to the On Alarm icon, and optionally select activity properties to reflect the actions to take when the alarm goes off.
To build an onMessage branch of a Pick
- 1. From the Gateway palette, drag an Event-based gateway activity to the Process Editor canvas.
- 2. Select the OnMessage branch.
- 3. In the Properties view of the OnMessage, create a new participant, if needed, or select one from the list.
- 4. Drag an activity, such as a Script Task (an assign), to the On Message branch, and select activity properties to reflect the actions to take when the message arrives.
The following illustration shows an example of a Pick activity.
XML Syntax
<pick createInstance="yes|no"? standard-attributes>
standard-elements
<onMessage partnerLink="NCName"
portType="QName"? operation="NCName"
variable="BPELVariableName"?>+
messageExchange="NCName"?>+
<correlations>?
<correlation set="NCName" initiate="yes|join|no"?>+
</correlations>
<fromParts>?
<fromPart part="NCName" toVariable="BPELVariableName" />+
</fromParts>
activity
</onMessage>
<onAlarm>*
(
<for expressionLanguage="anyURI"?>duration-expr</for>
|
<until expressionLanguage="anyURI"?>deadline-expr>
</until>
)
activity
</onAlarm>
</pick>
Example:
<pick name="pick1" createInstance="yes">
<onAlarm> <for>‘PT30S'</for>
</empty>
</onAlarm>
<onMessage partnerLink="customer"
portType="lns:loanServicePT" operation="request"
variable="request" >
<reply activity>
</onMessage>
</pick>