BPMN Level 2 - Part 3

Large Scope: Errors, Transactions and Event Subprocesses

Large Scope

Error Handling

Error Handling

  • Modelling error scenarios as functional process paths in BPMN

  • Used to express an activity ended in an exception end state

  • Trigger may be technical or business exception

  • Activity did not complete normally

  • Handled as throw-catch with optional boundary events

  • Notational convenience for an exclusive gateway following the activity

bpmn level 2 error handling

Error Handling

  • Error boundary event on a task: task did not complete normally, trigger is hidden

  • Error boundary event on a subprocess: subprocess did not complete normally, trigger is visible with expanded subprocess (i.e., contains an error end event)

  • Because an error boundary event is always interrupting, parallel paths within a subprocess are cancelled by triggering it from e.g. one of the paths

  • Multiple error boundary events are allowed, signifying different exception end states (referenced with error codes)

Error Handling Example: Subprocess

bpmn level 2 error handling exclusive event

Error Handling Example: Task

bpmn level 2 error handling relocate supplier

Large Scope

Transactions

Transactions

  • ACID transactions vs. business transactions

    • ACID: short-running, technical transactions (with optional 2FC, XA, etc.)

    • Business: long-running transactions spanning multiple activities (all or nothing), often eventually consistent

  • BPMN offers the transaction subprocess

  • Not Isolated: resources (people and systems) are not locked, because the transaction is long-running

  • Rollback is implemented by compensation [1]

bpmn level 2 transactions

Rolling Back Transactions with Compensations

  • Don’t undo the original action, but perform another action to bring the state back to the original

  • Only compensate the actions that were already successfully completed

  • Sometimes referred to as the saga pattern

Compensation with BPMN: Compensating Activities

  • Connect compensating activities to activities with

    • Compensation boundary events and

    • Association links

  • Define the actions to perform for each activity to compensate for its side effects after successfully completing

  • Boundary event can not be triggered during the activity, only after

Activities that were cancelled (i.e., not completed) are not compensated!
bpmn level 2 transactions activities and compensating activities

Compensation with BPMN: Initiating Rollback

Initiate transaction failure and compensation with

  • Cancel end events inside a transaction subprocess

  • Catching the cancellation of the subprocess on the subprocess' boundary in a cancel boundary event

or

  • Compensation throwing events (intermediate or end) outside any transaction subprocess and

  • Invoking the compensation boundary events of completed activities

bpmn level 2 transactions initiating rollback

Compensation: Targets

  • Cancellation with cancel events implies compensation

    • All compensating activities for completed activities inside the transaction subprocess

    • Other, interrupting boundary events do not perform compensation!

  • Compensation without cancel events requires configuration of the target activity to compensate

    • This may be a transactional subprocess as well → all compensations are executed

  • Compensating activities are executed for each completed instance of a multi-instance activity

Transaction Subprocess Example

bpmn level 2 transactions webshop returns

Direct Compensation Example

bpmn level 2 transactions launch service

Large Scope

Event Subprocesses

Event Subprocess

  • A subprocess that is conditionally triggered by the event of its (single) start event occurring during the scope that it is part of in the parent process

  • If the start event is interrupting (solid border), the entire scope is interrupted if it triggers (but may complete normally!)

  • If the start event is non-interrupting (dashed border), the event subprocess is triggered in addition to the parent scope if the event triggers

  • The parent process can only complete when any triggered event subprocesses have completed as well

  • Not attached/connected to other elements with control flow (floating)

bpmn level 2 event subprocesses

Event Subprocess

  • The event subprocess can only be triggered while its containing scope is active

    • Excellent fit for potential events during multiple activities: prevents repeated boundary events

    • Defines scope when certain events can be dealt with and when they can not yet or not anymore be handled

  • Has access to context of parent process

  • May be drawn collapsed or expanded (tool support varies)

  • Can throw error to boundary of containing process 🤘

Event Subprocess: Start Event Types

  • Can not be none start event

  • Message start event

  • Timer start event

  • Signal start event

  • Conditional start event

  • Escalation start event

  • Error start event

  • Compensation start event

Event Subprocess Example

bpmn level 2 event subprocesses cancel order

Event Subprocess: Completing Condition

bpmn level 2 event subprocesses watch world cup match

Event Subprocess with Compensation Start

  • When compensation is triggered, an event subprocess can be triggered

  • Subprocess can perform multiple activities

  • Convenient when compensating activities don’t match up with original activities

  • Use compensation start event for event subprocess

Event Subprocess with Compensation Start Example

bpmn level 2 event subprocesses better call saul

Large Scope

Method & Style

Method & Style

  • With throw - catch: place boundary event close if possible

  • When using pairs and/or sets of throwing and catching events, use the same labels for visual linkage

    • Even more important when there are multiple sets in a model

Using Signals

  • Consider signal events only when message events, escalation events and error events don’t suffice

    • Messages communicate with other pools

    • Errors and escalations can only throw to the boundary of their parent

  • Use signal events when you need these characteristics:

    • Communication / synchronisation between parallel branches inside a process

    • Broadcast (publish/subscribe) between processes

    • Throw and continue normally (as opposed to error events and terminate events)

Errors

  • Be deliberate when applying errors: rely on default behaviour for other situations

  • Did the activity complete normally? Errors imply interruption

  • Consider error end event for a process, even if not catching

Transactions

  • Don’t apply transaction subprocesses everywhere

    • Most useful for coordinated and/or automated compensation

  • Consider process scope when applying compensation

    • Don’t expand the scope just to benefit from compensation features

    • The goal is not to capture entire life cycles in as few process models as possible

Event Subprocesses

  • Use event subprocess to prevent repeated boundary events

  • Use compensation start event for event subprocess if compensations are not 1:1 with activities


1. This is comparable to the way ledgers are maintained