Syntax

Boundary events

Attach a timer, error, message or other event to a task, and say where the flow goes when it fires.

A boundary event sits on the edge of a task. It catches something that happens while the task runs, such as an error or a deadline. Write it as an indented line under the task:

Flowmark
process Card payment

start Checkout completed
service Charge card
  on:error Card declined -> Ask for another card
  on~timer(PT10M) Charge taking long -> Notify support
end Payment taken

user Ask for another card
end Payment failed

send Notify support
end Support notified
  • on: makes an interrupting event. The task stops and the flow leaves through the event.
  • on~ makes a non-interrupting event. The task keeps running, and the event starts a path alongside it.
  • The event type comes right after on: or on~, and it's required. A space between them is fine, so on: error reads the same as on:error.
  • The name and the -> Target are optional. A boundary event with nowhere to go is a dead end, and the checks flag it.

A timer takes its value the same way as other events, as in on~timer(PT10M). So does the name of an error, message, signal or escalation it catches, when that isn't the event's own name: on:error(Card declined) Payment refused. See Share a message, signal or error.

Boundary events don't end the chain. In the example, Charge card still connects to Payment taken on the next line.

Attach them to tasks, sub-processes and call activities only. The checks report an error for a boundary event on a gateway or another event. A boundary event can't take an #id, and an arrow by name never points to one.

A message from another party

A message boundary event can say where its message comes from: a pool, or one of another party's steps. Write a <= line under the on:message line, indented further:

Flowmark
process Order
pool Customer

start Order placed
user Pack order
  on:message Customer cancels -> Refund payment
    <= Customer: Cancellation
service Ship order
end Order shipped

service Refund payment
end Order cancelled

The message's line runs from the pool to the event, round the task it sits on.

Another party's step can send to the event by its name, as in => Customer cancels under that step. Use the event's #id when a step has the same name. A boundary event only receives, so it can't have a => line. Only a message boundary event takes a message.

On the canvas, select the boundary event and choose Add message, then the pool it comes from, or a new one. A pool's own Add message lists message boundary events among the steps it can send to.

Undo a task (compensation)

When a later step fails, a task that already ran may need undoing. For example, a card charged for an order that can't ship is refunded.

  1. Attach on:compensation to the task, and point it at the activity that undoes it.
  2. Throw a compensation event where the undoing should happen.
Flowmark
process Order payment

start Order placed
service Charge card
  on:compensation -> Refund card
service Reserve stock
  on:error Out of stock -> Undo payment
end Order confirmed

throw:compensation Undo payment
end Order cancelled

service Refund card
  • The activity that undoes the task runs only when compensation is thrown, so it has no other arrows in or out. The app draws it with a rewind marker, and its link from the event is dotted.
  • A compensation event points at exactly one activity.
  • end:compensation throws compensation as the path ends. It replaces a throw:compensation followed by an end. On the canvas it's Compensation end in the end-event list and in Change type.
  • In the BPMN XML, the link is an association and the activity is marked isForCompensation.

Several triggers, and cancel

on:multiple fires on whichever of several things happens first. on:parallel fires once all of them have.

on:cancel catches the cancelling of a transaction, a sub-process whose steps succeed or are undone together. It always stops the transaction.

Flowmark
process Trip booking

start Trip requested
sub Book flight and hotel
  on:cancel Booking cancelled -> Tell traveller
  on~multiple Change requested -> Note change
end Trip booked

send Tell traveller
end Trip not booked

user Note change
end Change noted

For more, see Deadlines and reminders and Errors and exceptions.

On this page