Business Process Model And Notation 2.0 (BPMN) is an industry standard for process modeling and execution. A BPMN process is an XML document that has a visual representation. For example, here is a BPMN process:
The corresponding XML
This duality makes BPMN very powerful. The XML document contains all the necessary information to be interpreted by workflow engines and modeling tools like Zeebe. At the same time, the visual representation contains just enough information to be quickly understood by humans, even when they are non-technical people. The BPMN model is source code and documentation in one artifact.
The following is an introduction to BPMN 2.0, its elements and their execution semantics. It tries to briefly provide an intuitive understanding of BPMN's power but does not cover the entire feature set. For more exhaustive BPMN resources, see the reference links at the end of this section.
The best tool for modeling BPMN diagrams for Zeebe is the Camunda Modeler.
A core concept of BPMN is a sequence flow that defines the order in which steps in the process happen. In BPMN's visual representation, a sequence flow is an arrow connecting two elements. The direction of the arrow indicates their order of execution.
You can think of process execution as tokens running through the process model. When a process is started, a token is spawned at the beginning of the model. It advances with every completed step. When the token reaches the end of the process, it is consumed and the process instance ends. Zeebe's task is to drive the token and to make sure that the job workers are invoked whenever necessary.
The basic elements of BPMN processes are tasks, atomic units of work that are composed to create a meaningful result. Whenever a token reaches a task, the token stops and Zeebe creates a job and notifies a registered worker to perform work. When that handler signals completion, then the token continues on the outgoing sequence flow.
Choosing the granularity of a task is up to the person modeling the process. For example, the activity of processing an order can be modeled as a single Process Order task, or as three individual tasks Collect Money, Fetch Items, Ship Parcel. If you use Zeebe to orchestrate microservices, one task can represent one microservice invocation.
See the Tasks section on which types of tasks are currently supported and how to use them.
Gateways are elements that route tokens in more complex patterns than plain sequence flow.
BPMN's exclusive gateway chooses one sequence flow out of many based on data:
BPMN's parallel gateway generates new tokens by activating multiple sequence flows in parallel:
See the Gateways section on which types of gateways are currently supported and how to use them.
Events in BPMN represent things that happen. A process can react to events (catching event) as well as emit events (throwing event). For example:
The circle with the envelope symbol is a catching message event. It makes the token continue as soon as a message is received. The XML representation of the process contains the criteria for which kind of message triggers continuation.
Events can be added to the process in various ways. Not only can they be used to make a token wait at a certain point, but also for interrupting a token's progress.
See the Events section on which types of events are currently supported and how to use them.
Subprocesses are element containers that allow defining common functionality. For example, we can attach an event to a sub process's border:
When the event is triggered, the sub process is interrupted regardless which of its elements is currently active.
See the Subprocesses section on which types of subprocesses are currently supported and how to use them.