Transactional processes are used to coordinate multiple activities that need to be completed successfully. If any of them are not successful it is necessary to return to the initial state (a state before the activities where ever performed). BPMN uses the following diagram element to represent a Transactional Sub-process:
The long lasting transactional BPMN models have three possible outcomes:
•The first outcome is when all activities in the process are successfully performed, the process continues with the normal flow.
•The second outcome is when a failure occurs, and it is necessary to reverse all activities that have already been completed within the process. This is achieved through the execution of compensation activities. Each activity that needs compensation has one task associated to it. Compensation is executed when it is necessary to return to the initial state of something and is only performed when an activity has successfully ended.
•The last outcome occurs when an unexpected error is presented, the transactional sub-process activities are interrupted without any compensation and the process continues with the intermediate error event.
To model a transactional process it is necessary to attach the Error and Cancel events to the sub-process. In any of these two events occur the process will have a flow to continue:
To demonstrate this type of process we are going to use the a travel request.
When a travel request is made, it is necessary to make reservations for travel, hotel and car hire. If any one of them cannot be successfully completed, then the whole trip is not possible. The reservations that were made successfully, must be compensated.
The following images illustrate these three possible outcomes:
The complete process looks like this.
To Model the activities of the Sub-Process include the required activities. In this case we will include three activities, Book Car, Book Hotel and Book Flight.
Include a compensation event for each activity. This way, if any activity fails, the completed activities can be compensated.
Now your Process is complete: The parent Process contains the sequence flows that will allow the Process to take action if the Sub-process fails to complete successfully. The Sub-process contains actions that will compensate any reservation that has already been performed correctly.