Using the Cancellation Event Handler

You can execute a cancellation event handler flow (only one per process) to manage the cancellation of a process and its sub-processes.

Procedure

  1. How to cancel a sub-process task: Attach a catch intermediate event to a call sub-process task in your main process, with a trigger type of Catch Signal. The Catch Action should be Cancel task when signal caught.
    Alternatively, you cancel a process sub-process task with a task boundary event as follows:

    Message:

    Timer:

    Trigger:

    The tree of subprocess instances that were instantiated from a sub-process task are cancelled from the bottom up. If the sub-processes need to execute compensation actions to close down gracefully they can do so using Cancellation Event handlers.

  2. The Sub-Process Cancellation event handler: Add activities to perform any actions required prior to the final sub-process cancellation. A common pattern would be to use throw-catch compensation as in the example below, where there is an intermediate catch event with trigger type Catch Compensation on each task in the a sub-process which requires compensation events. Compensation events execute their actions if only when the the task they're attached to has been executed, thus there is not a need to manually conditionalize compensating tasks depending on progress throw the main process flow.
    Note: Cancel event handlers are only executed for process-driven cancellation (not for user/API-driven process cancellations).
    Note: The cancel event handler does not have to trigger compensation event handlers. It may either generate signal events into the main part of the process or just perform the compensatory actions directly.
    Note:
    • The sub-process can also invoke another sub-process (and so on) with more cancel event handlers.
    • There does not have to be a cancel event handler in each sub-process if it is not required.
    • Cancellation event handlers will not be executed when a process instance is cancelled through Process Manager API, either from an external application or from the Openspace client.
    • If a cancellation event handler fails then you will receive an audit event and should be able to recover from an halted state.