Page 315 -
P. 315
11 The Worklet Service 311
Fig. 11.14 Rule detail for
Arrange Delivery
Appointment timeout
11.7.3 Timeout Example
YAWL allows for each work item to be associated with a timer. When a work item
timer expires, the engine notifies the Exception Service. Then, the Timeout rule
tree (if any) for the task is parsed for the appropriate response to the timer expiry
event. For example, if the Arrange Delivery Appointment task were to expire before
a suitable delivery time could be agreed upon, the timeout tree set is queried for the
task, and the appropriate exlet is invoked. There may be a number of exlets defined
for a timeout on this task, which may take various actions such as extending the
timer, setting a default delivery time, make other arrangements with the client, or
even cancel the order, depending on the context of the case.
Figure 11.14 shows the rule tree defined for the TimeOut exception type for
the Arrange Delivery Appointment task. Notice the rule’s condition isNotCom-
pleted(this):
isNotCompleted is an example of a defined function that may be used as (or as
part of) a conditional expression in a rule node.
this is a special variable created by the Worklet Service that refers to the work
item that the rule is defined for and contains, amongst other things, all of the
work-item’s data attributes and values.
In this example, the condition tests if the work item has not yet been completed
(i.e., if it has a status of Fired, Enabled, Executing,or Suspended). If it has not
completed (thus arrangements for delivery have not yet been completed), then the
conclusion (exlet) will be executed, which includes the launching of the compen-
satory worklet SendReminder.The SendReminder worklet consists of three tasks:
Send Request, and the parallel tasks wait and Receive Reply –the wait task in this
specification is again associated with the timer. When its wait task times out, the
Exception Service is again notified. The rule set for the SendReminder specification
also contains a single timeout rule for the Receive Reply task – its condition is again
isNotCompleted(this), but this time the rule’s conclusion is that shown in Fig. 11.15.