IBM BPM, V8.0.1, All platforms > Get started with IBM BPM > Key concepts > BPEL processes and human tasks > BPEL processes overview > Fault and compensation handling in BPEL processes > Compensation handling in BPEL processes

Compensation handling in long-running BPEL processes

Compensation for long-running processes is also known as business-level compensation. The compensation logic can be defined on the scope level, for invoke activities, or for human task activities. This means that either a single invoke activity or human task activity, or a set of activities in a scope can be compensated.

In BPEL processes, compensation is triggered by fault handlers of a scope or the process, or by the compensation handler of a scope or an invoke activity.

In BPMN processes, compensation can be triggered from outside compensation and fault handlers via the compensate activity. This support is available for generalized flow activities and collaboration scopes, where compensation can be triggered from within the flow or scope. In this case, the compensate activity triggers the compensation of all the activities in the current scope that completed successfully before the compensate activity started. When all of these activities are compensated, the compensate activity completes and the navigation of the process continues.

If the compensation of a completed activity fails, the compensate activity continues to trigger the compensation of the remaining activities. When the compensation of these activities finishes, the compensate activity passes the fault from the failed compensation to the enclosing scope


Compensation of child processes

A long-running process can also compensate child processes that have successfully completed. A child process is called by an invoke activity. This invoke activity can have a compensation handler associated with it. If a compensation handler is defined, its logic determines whether compensation for the child process is triggered by the compensate activity. If the compensation handler does not use the compensate activity, compensation for the child process does not occur. If the invoke activity does not have a compensation handler, then compensation for the child process is triggered automatically.

For long-running child processes, compensation is run for all of the successfully completed, directly nested scopes on the process level in the reverse order of their completion. For microflow child processes, compensation runs the undo actions of all of the invocations in the reverse order of the forward execution of the invocations.

In general, only human task activities, invoke activities (including those activities that called a child process), and scope activities, that complete successfully are compensated. Compensation of these activities can be done in one of the following ways:

Compensation handling in BPEL processes