IBM BPM, V8.0.1, All platforms > Authoring services in Integration Designer > Developing business processes > Building BPEL processes > Defining BPEL process logic > Dealing with faults in your process > BPEL process compensation

Compensating activities in a long-running process

In a long-running process, each transaction within it is committed individually. To set up compensation, you need to specify how to deal with each activity should it fail.

Before you can create a compensation for a process, you will need to identify a few things:

BPEL process compensation

Building BPEL processes


Related concepts:
Business processes
Work with BPEL extensions
Choose between long-running processes and microflows
Best Practice: When to not use the BPEL extensions


Related tasks:
Compensating a microflow


Related reference:
Server tab: BPEL process editor


Compensation using Compensation Handlers (BPEL)

To compensate the individual activities within a long-running process:


Procedure

  1. To begin, you will have to make this a long-running process. To do this, click an empty area of the canvas, click the Details tab in the properties area, and check the BPEL process type setting. If it is not set to Long-running, click the "Refactor to .. " link to make it Long-Running.

  2. Select either one of the following activities onto the canvas: invoke, scope, collaboration scope or human task. Use an invoke or human task if you will be creating a compensation handler for a single activity of this type, or use a scope or collaboration if you want to compensate the whole structured activity.

  3. Click this activity to launch the action bar.

  4. In the action bar, click the Add Compensation Handler icon as shown in this image. This will create a handler (an empty box outlined in gray) beside the original activity.
  5. Populate this compensation handler with the activities needed to create the compensation logic.
  6. If a compensate activity itself is part of your compensation logic, you have two choices:

    1. the compensate activity should compensate everything that is included in your selected activity: (default, do nothing)
    2. the compensate activity should compensate a specific invoke, scope, collaboration scope or human task activity that is included in your selected activity, then you must specify that target activity in the Target Activity field in the Details tab for this compensate activity.


Results

If the process fails anytime after the invoke or scope activities have successfully been committed, then the associated compensation handler will be executed.


BPMN-style Compensation

Furthermore, you can also add compensate activities to generalized flow activities, in order to achieve a "BPMN-style" compensation. Compensate activities can be included in a generalized flow activity if and only if:

If any of the listed conditions is violated, adding a compensate activity to a generalized flow will cause a validation error.


Results

The usage of compensate activities in generalized flow activities might be useful in combination with fault links. When a compensate activity in a generalized flow activity is activated, everything that has successfully completed in the GFlow until now and that has a compensation handler is compensated by this compensate activity.