Some events can happen on the Boundary of an activity. This indicates that the event can interrupt the activity, and will divert the sequence flow from the “normal” flow to another flow. Boundary events are catching events that are attached to an activity (a boundary event can never be throwing). This means that while the activity is running, the event is listening for a certain type of trigger. When the event is caught, the activity is interrupted and the sequence flow going out of the event are followed.
Message Boundary Event
Boundary events are catching events that are attached to an activity. This means that while the activity is running, the message boundary event is listening for named message. When this is caught, two things might happen, depending on the configuration of the boundary event:
- Interrupting boundary event: The activity is interrupted and the sequence flow going out of the event is followed.
- Non-interrupting boundary event: One token stays in the activity and an additional token is created which follows the sequence flow going out of the event.
Compensation Boundary Event
In BPMN, the concept of compensation is introduced, using compensation events and compensation handlers.
If an Activity is still active, it cannot be compensated, but rather needs to be canceled.
The compensation boundary event is activated when the activity it is attached to completes successfully.
A compensation handler performs the steps necessary to reverse the effects of an Activity.
For example, the following excerpt of a process shows how we can declare that the “Book Hotel” activity can be compensated using the “Cancel Hotel Reservation” activity. If a task has multiple instance characteristics (like the “Book Hotel” task in this example), the compensation handler is invoked for each instance that completed successfully.
- May be used as part of an exception handling procedure
Rollback of completed process activities. E.g. Bookings for holidays have successfully been completed (Step 1).
However, it turns out that the given credit card details were incomplete. A booking rescission is necessary.
- Triggered by throwing Compensate Event:
- Compensation Handler (Cancel Step 1; triggered by a catching Compensate Event) performs the rollback.