Event Wait:
An event which must occur before an Activity Instance can be completed.
Only Activity Instances which depend on some other event have an associated Event Wait. These Activity Instances are:
- manual Activity Instances (Tasks), which wait for some user-generated event; or
- 'event wait' Activity Instances, which wait for some system-generated event not strictly related to the workflow, e.g. the completion of some deferred or batch-driven application processing.
Automatic Activity Instances do not depend on an event and are automatically marked as completed by the Workflow Engine as soon as they are executed. An automatic Activity Instance has no related Event Wait.
Example
You define a workflow (Process Definition) to allow correspondence to be sent to customers whenever their payment details change. The activities defined in your workflow are:
- system prints out a letter (automatic); and
- User puts the letter in an envelope and posts it (manual).
Person John Smith's payment details change due to an increase in rates. This increase raises an event which causes the Workflow Engine to enact your workflow and create a Process Instance.
The system creates and executes the first (automatic) Activity Instance which prints out the letter.
The system transitions to the next activity definition in your workflow and creates the second Activity Instance. Because this Activity Instance is a manual one, when the Workflow Engine executes the Activity Instance, it also creates:
- a Task which details the work to be done; and
- an Event Wait which registers the Workflow Engine's 'interest' in the result of the Task.
The Task is assigned to User Ronan Rooney. The Task instructs Ronan to collect the letter from the printer and post it. Ronan performs this work and in the correspondence screen marks the letter as 'sent'. Curam raises a 'correspondence sent' event by calling the 'raise event' function.
The Event Match Engine:
- receives the event;
- searches the Event Wait table to identify which Activity Instance(s) are waiting on the event;
- finds the Event Wait relating to the Activity Instance for the 'User puts the letter in an envelope and posts it' activity in the Process Instance created for John Smith's payment increase;
- deletes the Event Wait row;
- creates a Workflow Event Audit row; and
- instructs the Workflow Engine to continue.
The Workflow Engine marks the Activity Instance as completed and follows the transition out of it.
Technical Notes The metadata for the activity stored in the Process Definition defines whether an Activity Instance will have an associated Event Wait.
An Activity Instance may wait on multiple events and thus have multiple related Event Wait rows. When any one of these events is raised, the Workflow Engine:
- removes all Event Wait rows related to the Activity Instance;
- creates a single Workflow Event Audit row detailing which Event Wait was actually matched to the event; and
- continues processing the workflow.
|