In a long-running process, each transaction is committed individually.
To set up compensation, you specify how to deal with each transaction should
it need to be compensated if the process fails.
Before you can create a compensation for a process, you will need
to identify a few things:
- The potential condition that would put the process into an unbalanced
state, and where this might happen in the process.
- The step(s) necessary to deal with it, and return the process to an equitable
state.
To compensate a process, proceed as follows:
- 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 enable the Process is long-running check
box.
- Drop either an invoke or a scope activity onto the canvas. Use an invoke if you will be creating a compensation handler for a single
activity, or use a scope if it is for a group of them.
- Click this activity to launch the action bar.
- In the action bar, click the compensation handler icon as shown
in this image.

- Populate the compensation handler with the activities needed to
create the compensation logic.
Now, if the process fails anytime after the invoke or scope activities
have successfully been committed, then the associated compensation handler
will be executed.
Note: A compensation handler will only run if the activity
with which it is associated has completely successfully.