Databases Reference
In-Depth Information
Completing the aggregation
All that remains is to add in the logic that enables the process to determine when
the aggregation is complete. For a scenario where we know how many messages we
expect, every time we receive a message, we just need to check whether there are any
outstanding messages and proceed accordingly.
However, for scenarios where we are waiting for a fixed duration, as is the case with
our auction process, it's slightly trickier. The challenge is that for the period over
which the auction is running, the process will spend most of its time in a paused
state , waiting for the <receive> activity to return details of the next bid.
So the only opportunity we have within the logic of our process to check whether
the duration has expired is after the receipt of a bid, which may arrive long after the
auction is completed or not at all (as the auction has theoretically finished).
Ideally, what we want to do is place a timeout on the <receive> activity, so that
it either receives the next bid or times out on completion of the auction, whichever
occurs first.
Fortunately, this can be easily accomplished by replacing the <receive> activity
for the submitBid operation with a <pick> activity. The <pick> would contain two
branches: an onMessage branch configured in an identical fashion to the <receive>
activity and an onAlarm branch configured to trigger once the finish time for the
auction has been reached.
To configure the onAlarm Branch , double-click on it to open the OnAlarm Branch
activity window, as shown in the following screenshot:
 
Search WWH ::




Custom Search