Advanced BPMN concepts#

This section continues from the BPMN basics and introduces more advanced BPMN concepts.

Alternative start events#

../_images/more-start-events.svg

While the plain start event could be triggered through APIs to start processes in custom ways, also BPMN itself supports multiple ways to start processes. For example, timer start event can start a new process instance periodically, or message start event from a BPMN message (even from an another process instance). more-start-events.bpmn#

The above example introduced the following new event type:

  • message events, for sending and receiving targeted messages, e.g. for inter-process communication

Intermediate events#

../_images/intermediate-events.svg

In addition to start event, end event, and boundary event, BPMN has intermediate event too. The simplest use case for them is to use empty intermediate events for marking relevant business states in the process (as metrics like KPIs in later data analysis). intermediate-events.bpmn#

Even more events#

../_images/more-events.svg

Events in BPMN 2.0: start events, interrupting and non-interrupting start events, intermediate throw events, intermediate catch events, interrupting and non-interrupting boundary events, and end events. All in many different types. more-events.bpmn#

The above example introduced the following new event types:

  • signal event, for sending and receiving broadcasted signals, e.g. for mass-cancellation of processes

  • conditional event, for being triggered on a condition, e.g. a process variable value change

  • compensation event, for triggering compensation tasks for already completed, but now compensated tasks.

Compensation#

It is usual in BPMN that the same result can be achieved in multiple ways. For example, in testing, one must usually setup the environment before running the tests and clean up after the tests. Obviously, this can be achieved with just the basic BPMN constructs:

../_images/without-compensation.svg

In this example, the test requires cloud resources, which are provisioned and waited for before the actual execution. without-compensation.bpmn#

Tip

BPMN pools and communication between the pools do not affect the execution of the model in the BPM engine but allow better visualization and documentation of the process in its context.

Alternatively, the same can be achieved with a compensation event and accompanying compensation tasks connected to the tasks they are about to compensate if tasks have been executed successfully:

../_images/with-compensation.svg

When a process ends with compensation end event, the process engine will automatically execute the compensation tasks for the tasks that have been successfully executed. with-compensation.bpmn#

Multi-instance#

../_images/multi-instance-subprocess.svg

Tasks and embedded sub-processes can be configured to be multi-instance – the BPMN way to loop over a collection. The configuration can be either parallel or sequential. Multi-instance requires an input collection to be configured for it, but then it executes task or sub-process separately for every input item in the collection with one BPMN symbol. multi-instance-subprocess.bpmn#

Script task#

../_images/script-task.svg

Script task is a task that allows executing custom scripts directly in the process engine being used. The supported scripting languages depend on the engine but typically include JavaScript, Groovy, or Python (Jython or GraalPy, which has not been implemented yet).

In Operaton BPMN engine, a script task can manipulate multiple process variables using its execution.setVariable API, or assign its return value to a single result variable.

Business rule task#

../_images/business-rule-task.svg

Business rule task is a special task type reserved for automated rule-based decision making in a process. It’s typically configured to use DMN (Decision Model and Notation) decision tables, designed to describe business rules. Additionally, DMN tables can be maintained separately from the process models, allowing for faster iterations.#

This test case selection example demonstrates how a business rule task with DMN decision table can be used to select test cases based on the test case selection criteria. Even in this simple example, the DMN table should be compact and easier to maintain than the equivalent conditional logic in classic programming languages.

Select test case
Unique
When
Hour of day
integer
And
A / B
string
Then
Test case
string
Annotations
1[0..6]"A""Nightly Test A"-
2[0..6]"B""Nightly Test B"-
3[7..12]"A""Morning Test A"-
4[7..12]"B""Morning Test B"-
5[13..18]"A""Daily Test A"-
6[13..18]"B""Daily Test B"-
7[19..24]"A""Evening Test A"-
8[19..24]"B""Evening Test B"-

test-case-selection.dmn