Pick first groups allow process execution to wait for one or more events. The first event that completes determines which transition to take to continue processing. For example, as part of an order-entry system, when an order is placed, a check is made to see if the order can be filled from stocked inventory or from returned merchandise. Whichever system returns the information first is used to fill the order. If neither system returns the information about available inventory, the order times out and cancels.
The following illustrates an orchestration process that uses the Pick First group to implement the business logic described above. An order is received and a process is called to query the inventory system and the returned merchandise system. A transition is then taken to the Pick First group. The group then waits for either the return message from InventoryAvailable, the return message from ReturnMerchAvailable, or the Timeout activity. The first activity to complete determines the next transition taken. If either InventoryAvailable or ReturnMerchAvailable complete first, the transition to the ProcessOrder activity is taken. If the Timeout activity completes first, the transition to the CancelOrder activity then the Exit activity is taken.
To specify the events that you would like to wait for, draw transition lines from the start of the group to the desired activities. Only Receive Starter, Receive, and Sleep activities can have valid transitions from the start of the Pick First group. If the transition is valid, the activity is highlighted in green. If the transition from the start of the group is drawn to an invalid activity, the activity is highlighted in red.