Developer Guide to the BPEL Designer

Using a Compensation Handler

When to Use

A business process often contains several nested transactions. The overall business transaction can fail or be cancelled after many enclosed transactions have already been processed. Then it is necessary to reverse the effect obtained during process execution. For example, a travel planning process can include several nested transactions to book a ticket, to reserve a hotel and a car. If the trip is cancelled, the reservation transactions must be compensated for by cancellation transactions in the appropriate order. For such cases, WS-BPEL provides you with the capability to define compensation actions. A Compensation Handler is a container for the activities that perform compensation actions. You can add one Compensation Handler to either the Scope or the Invoke elements. The compensation handler can be invoked by Using the CompensateScope ElementUsing the Compensate Element activity.

ProcedureTo add a Compensation Handler to Scope or Invoke elements:

  1. Right-click the Scope or Invoke element and choose Add > Compensation Handler. An empty container element appears.

  2. From the Palette, drag one or several activities that will be executed and place them inside the Compensation Handler container. Configure the properties of each activity.


    Note –

    You do not have to configure any properties for the compensation handler.