Java Reference
In-Depth Information
Selective Event Processing
Problem
You want your process to wait for a given event to occur from within a set of possible events,
and then execute the activity associated with that event.
Solution
Use the standard <pick> construct.
Discussion
There are two “start” activities in BPEL. The first, and perhaps most common, is <receive> ,
and the other is <pick> .
A <pick> is similar to a switch/case construct in programming languages; it allows you to
define a set of events you are interested in getting notice for, typically when a message from
a certain operation is received. When the process detects that this event has occurred, it will
execute the activities associated with that event. In its most common form, this “event” is an
<onMessage> construct that indicates the portType and operation that it is waiting to get
messages from.
When you use the attribute value of createInstance="yes" , an <onMessage> activity is
equivalent to a <receive> , in that it waits to get a message incoming to the process. Once
an <onMessage> is activated, it can perform any kind of process work, which typically is to
invoke a web service operation exposed by the business process using a variable containing
the received message. Further, once an event has been selected, none of the other event pos-
sibilities can be accepted by that <pick> .
Here is the basic outline of this activity:
<pick name="Pick1">
<onMessage partnerLink="SupplyServicePLink"
operation="addItem"
portType="sp:purchaseOrderPT"
variable="LineItemIn">
<correlations .../> <!--do work to accept a new order line item-->
</onMessage>
<onMessage partnerLink="SupplyServicePLink"
operation="submitOrder"
Search WWH ::




Custom Search