Description
A Compensation in business process modeling is concerned with undoing steps that have already been successfully completed because their results and possible side effects are no longer desired and need to be reversed. If an Activity is still active, it cannot be compensated and needs to be canceled. The cancellation of a SubProcess can produce a compensation of the already successfully completed portions of an active Activity.
A Compensation is performed by a compensation handler. A compensation handler performs the steps necessary to reverse the effects of an Activity. For a SubProcess, the compensation handler will have access to the SubProcess data once they have been completed (“snapshot data”).
A compensation handler is a set of Activities that is not connected to other portions of the BPMN model. The compensation handler starts with either of the Compensation Events:
- Compensation Boundary Event
- The handler’s Start Event (in case of a Compensation Event SubProcess)
A compensation handler connected through a boundary event can only perform a “black-box” compensation of the original Activity. This compensation is modeled with a specialized Compensation Activity, which is connected to the boundary event through an association. The Compensation Activity, which can be either a Task or a SubProcess, is marked to show that it is used for compensation only and is located outside the normal flow of the Process.
Compensation handler connected through Compensation Boundary Event
Another way to model a compensation is using a compensation handler, which starts with a Start Event of an Event SubProcess that is contained within a Process or SubProcess. Just like any other Compensation Activities, a Compensation Event SubProcess is located outside the normal flow of a process. The Event SubProcess, which is marked with a dotted line boundary, has access to data that are part of the parent, which is a snapshot at the point in time when the parent has been completed. A Compensation Event SubProcess can recursively trigger a compensation for activities contained in its parent.
Example