What is Compensation?
Compensation undoes the steps of a business process that are already successfully complete. If a process is abandoned, compensation reverses the effects of the previous activities that were part of the process.
For example, let's say you're running a boat chartering service. In your business process you have several transactions that depend on each other; verifying credit, reserving the boat, and reserving a mooring slip. If the sailing trip is cancelled, you will want the transactions to be rolled back, or compensated for, in a particular order. BPEL has the capability to set up compensation to do just that. The Scope activity specifies that part of the transaction that is reversible by defining a compensation handler. Handlers can be configured on a process or scope level.
Additional information about compensation:
- The compensation actions might need to run in the same order as the original actions.
- Data is not automatically restored during compensation. It is up to the application to define its own compensation behavior.
- A business process can continue running even if part of it must be reversed.