Skip to main content

BPMN engine

BPMN engine tries to adhere to the bpmn 2 specification and be compatible with Camunda 8. The engine can be used through the ZenBPM platform or as a standalone library.

The engine is fully instrumented via OpenTelemetry:

  • Tracing: Each process, token, and flow node has spans.
  • Metrics: Tracks counts of started, ended processes, worker executions etc.

Storage

The engine uses a storage interface to interact with storage systems. ZenBPM platform implements a solution based on RqLite database. The codebase also provides a default implementation for in memory storage that is used by the engine's Unit tests.

Node processing in the engine

Internally the engine uses "Tokens" as a pointers that traverse the diagram and represent execution state. Tokens are manipulated based on node logic (e.g., split for gateways, wait for messages/timers). One loop through the engine's main loop means processing the token's flow node and outgoing sequence flows.

Execution Tokens

Tokens (ExecutionToken) track progress through flow nodes:

  • Key: Unique identifier.
  • ElementId: ID of the current BPMN element.
  • State: Running, Waiting, Completed, Failed.

Exclusive Gateway example

The following example shows processing of an Exclusive Gateway.

Since Exclusive Gateway cannot create parallel flows the token gets reused and continues to flow through the diagram.

Parallel Gateway example

The following example shows processing of a Parallel Gateway.

To keep track of the parallel executions the token that activated the gateway is completed and outgoing parallel flows get assigned a new tokens that each represents a parallel execution flow.

Interacting with the BPMN engine

Business Key

For the correlation of process instances to external business entities businessKey attribute can optionally be used. This attribute allows you to efficiently identify the process instance which is associated with the business entity.

For usage please see OpenAPI.

Workers

XML parser

TODO: add information about how we are parsing xml definitions of processes