BPMN Level 2 - Part 2

Medium Scope: Gateways and Iteration

Medium Scope

Gateways

Inclusive Gateway

  • Splits and merges conditionally parallel paths

  • Splitting behaviour: evaluate all conditions of outgoing sequence flow and follow each matching path in parallel

  • Merging behaviour: join all activated incoming sequence flows and proceed after arrival of the last[1]

bpmn level 2 inclusive gateway

Inclusive Gateway Split and Merge

background

Inclusive Gateway Following Business Rule Task

bpmn level 2 business rule tasks activate services

Inclusive Gateway For Ad-Hoc Paths

background

Default Flow

  • Applies to exclusive and inclusive gateways

    • In diverging (splitting) behaviour

  • Default does not mean "by default" or "always", but otherwise

    • Check the conditions of outgoing sequence flows

    • If nothing matches, take the sequence flow marked as default

Default Flow: Example

background

Event Based Gateway

  • Chooses a process path based on the event[2] following the gateway that triggers first

  • Event types allowed:

    • Message

    • Signal

    • Conditional

    • Timer

  • Flow continues on the single path leaving the event that fired

  • Only used as diverging gateway, no merge behaviour

bpmn level 2 event based gateways

Event Based Gateway

bpmn level 2 event based gateways online sales

Birds of a Feather…​?

background

Event Based Gateway vs. Receive Task with Boundary Event(s)

  • Some would say, a matter of taste

  • They work the same, but do they mean the same?

  • Primary action vs. equality of actions

    • Use a task for a primary action with exceptions

    • Use a gateway if the various events are more equal (probability, frequency, value, etc…​)

Medium Scope

Iteration

Iteration

  • BPMN offers various ways to iterate in process models

  • Applied by multiple elements

    • Loop back with control flow

  • Applied with single elements

    • Loops (do…​ while)

    • Multi-instances (for each…​ do)

Loop Back with Control Flow

  • Manage the iteration yourself

  • Usually guarded by an exclusive gateway or conditional event (with event subprocess, later)

bpmn level 2 loopback control flow

Loop Back with Control Flow Example

bpmn level 2 loopback control flow clean house

Loops

  • Loop marker added to activity

  • The number of iterations is unknown upfront: a completion condition determines when the loop stops by turning false

  • Process engine[3] manages the iteration by evaluating the completion condition after each execution

  • Iteration is always sequential: the activity is conditionally repeated

  • An interrupting boundary event aborts the activity and thus, also the loop (breakout)

bpmn level 2 loop markers

Loops Example

bpmn level 2 loop markers movie night

Multi-Instance

  • Multi-instance marker added to activity and/or pool

  • Number of iterations is known upfront: one iteration for each item in a list of the process data

  • Typical use case: collections of sub elements

  • Process engine manages the iteration by executing once for each item

  • Iteration can be sequential or parallel: type of marker determines

    • 3 parallel horizontal bars: sequential

    • 3 parallel vertical bars: parallel

bpmn level 2 multi instance markers

Multi-Instance: Completion

  • The activity completes after all instances have been executed and completed, once (single token!)

    • This applies equally to sequential and parallel multi-instance activities

    • Any event subprocesses started inside the child instances must also be completed (later)

  • An interrupting boundary event typically[4] aborts the multi-instance activity (breakout)

  • A non-interrupting boundary event will spawn a parallel token to the activity from within any of the instances, so potentially many may be created

Multi-Instance Parallel Example

bpmn level 2 multi instance markers invoice accounts

Multi-Instance Sequential Example

bpmn level 2 multi instance markers acquire authorisations

Medium Scope

Method & Style

Gateways

  • Consider event-based gateway vs. receive task with boundary events

  • Don’t use names for event-based gateways and converging inclusive gateways: the behaviour is never process specific

  • For diverging inclusive gateway, consider naming as a question with answers on outgoing sequence flows, just like exclusive gateways

  • A business rule task is a natural predecessor to a diverging inclusive gateway

  • Don’t add conditions to sequence flows leaving an event-based gateway

Iteration

  • Always use a text annotation near the iteration marker to indicate the condition or collection

  • Consider using a separate process model for the contents of a multi-instance body because the objects you operate on don’t match 1:1

  • Multi-instance pools make most sense as part of a collaboration of pools because the relationship with the "parent" is visible

  • With interrupting boundary events, all instances will be aborted

Questions

background

1. Supported in Camunda 8 from version 8.6
2. Technically, a receive task is also allowed, but using events exclusively provides a more uniform reading experience and a message event accomplishes the same
3. Currently not implemented in Camunda 7 or 8. Use control flow loop to get the same execution effect
4. The BPMN specification leaves some room for interpretation on how this should be handled, but most implementers interpret the intent this way