Java Reference
In-Depth Information
portType="sp:purchaseOrderPT"
variable="SendPurchaseOrderIn">
<correlations .../> <!--do work for when order is complete -->
</onMessage>
<onAlarm>
<for>'P0DT2H'</for>
<empty/><!-- notify timeout on order completion -->
</onAlarm>
</pick>
In this example, you define two branches, one as a business partner that sends supplies they're
ordering, and in the other branch you complete the order. Once the order is complete, you will
do some work such as notifying shipping.
Using alarms
In the example just shown, an alarm will go off after two hours of waiting. Many of the
attributes used in the <onMessage> activity are the same as those used in <receive> . The
<onAlarm> behavior within a <pick> is similar to that of a <wait> , in which the countdown
begins right when the <pick> activity starts. It links a deadline to the execution of the activ-
ities. In the previous example, you used a <for> to express a duration, but you could also use
<until> .
If your <pick> has an attribute value of createInstance="yes" indicating that it is the start-
ing activity for the process, all of the <pick> 's children must be <onMessage> activities; that
is, it cannot have an <onAlarm> child in that case.
One usage for alarms in a <pick> is following an <invoke> . Your process could define a
sequence wherein an invoke is followed by a pick that contains one <onMessage> and one
<onAlarm> with a certain timeout. The alarm would time out after waiting a certain duration
for the message to be received. This allows you to keep your process from getting hung up by
a runaway service. It works well because, as you'll recall, other activities are disabled after
one has been selected.
Search WWH ::




Custom Search