Events

Intermediate Compensation Throw Event

Triggers the compensation handlers of already-completed activities — the BPMN way to “undo” finished work. Double thin circle with filled rewind arrows.

Business work often can't be rolled back like a database transaction — a booked hotel must be *cancelled*, a charged card must be *refunded*. The Compensation Throw Event invokes the compensation handlers (attached via compensation boundary events) of activities that already completed, in reverse order.

When to use and avoid

When to use

  • When a late failure requires undoing earlier completed steps (cancel bookings, reverse postings).

  • In sagas / long-running transactions where classic rollback is impossible.

  • Paired with compensation boundary events that define *how* each activity is undone.

When NOT to use

  • When nothing was completed yet — just route to an end.

  • For technical retries of a failing step — that is error handling, not compensation.

  • When a Transaction Sub-Process with a Cancel End already orchestrates the undo — don't double-trigger.

Business example

Undoing a hotel booking after payment is declined

Diagrama BPMN: Undoing a hotel booking after payment is declined
Undoing a hotel booking after payment is declined

Open this example in the HEFLO process editor and explore the diagram from the inside.

Open in the HEFLO editor →

Step by step

  1. Book hotel completes; its compensation boundary + handler “Cancel hotel booking” define how to undo it.
  2. Payment is declined at the gateway.
  3. The Compensation Throw Event (highlighted) fires — the engine invokes the handler of the completed booking, cancelling it — and the process ends with the request rejected.

Differences

Compensation vs Error

Error handles *this* failing step. Compensation undoes *previous successful* steps because a later condition invalidated them. They usually work together: an error triggers the path that throws compensation.

FAQ

In what order are handlers executed?

Reverse order of completion — the most recently finished activity is compensated first, like unwinding a stack.

Do activities without a compensation handler get undone?

No — compensation only reaches activities that declared a handler via a compensation boundary event.

Related elements