BPMN element · Events

Compensation Event

Definition

A Compensation Event is used to undo or roll back tasks that have already been completed in a process. It ensures corrective actions are taken to revert completed work when necessary, maintaining consistency and integrity within workflows.

Characteristics

  • Undo Completed Work: Activated only for tasks that have been successfully completed, ensuring that no unfinished tasks are rolled back erroneously.
  • Attached to Activities: Typically linked to transaction subprocesses or specific activities that require compensatory actions to maintain process integrity.
  • Triggered by Errors or Changes: Often activated in response to exceptions, external changes, or identified issues requiring resolution.
  • Ensures Process Integrity: By rolling back tasks, compensation events safeguard against cascading errors and ensure that processes align with the updated requirements.

Types of Compensation Events:

  • Start Event Subprocess Compensation Event: Initiates a subprocess for compensation when specific criteria are met.
  • Intermediate Boundary Compensation Event: Attached to an activity, this event triggers compensation actions when the activity is interrupted.
  • Intermediate Throw Compensation Event: Signals that compensation must occur, often triggering a compensation subprocess.
  • End Compensation Event: Marks the end of a process while triggering compensatory actions.

Example

At StayWise Hotels, booking a room is a breeze, guests can reserve their stay and tack on extras like breakfast or a relaxing spa session. Once the booking is confirmed, the system reserves the room and charges a partial upfront payment. After that, the guest gets a cheerful confirmation. On check-in day, the rest of the amount is charged, easy and seamless.

But if the guest cancels before check-in, a Compensation Event is triggered behind the scenes. This kicks off a clever rollback: the room is released, and the pre-paid amount is refunded. No panic, no chaos, just a smart, targeted undo of what’s already been done.