A Subprocess is an activity that contains other activities, gateways, events, etc. which itself forms a process that is part of the bigger process. A Subprocess is completely defined inside a parent process (that’s why it’s often called an embedded Subprocess).
Subprocesses have two major use cases:
- Subprocesses allow hierarchical modeling. Many modeling tools allow that subprocesses can be collapsed, hiding all the details of the subprocess and displaying a high-level end-to-end overview of the business process.
- A subprocess creates a new scope for events. Events that are thrown during execution of the subprocess can be caught by a boundary event on the boundary of the subprocess, thus creating a scope for that event, limited to the subprocess.
Using a subprocess does impose some constraints:
- A subprocess can only have one none start event, no other start event types are allowed. A subprocess must have at least one end event. Note that the BPMN 2.0 specification allows to omit the start and end events in a subprocess, but the current engine implementation does not support this.
- Sequence flows can not cross subprocess boundaries.
A subprocess is visualized as a typical activity, i.e., a rounded rectangle. In case the subprocess is collapsed, only the name and a plus-sign are displayed, giving a high-level overview of the process:
In case the subprocess is expanded, the steps of the subprocess are displayed within the subprocess boundaries:
One of the main reasons to use a subprocess is to define a scope for a certain event. The following process model shows this: both the investigate software and investigate hardware tasks need to be done in parallel, but both tasks need to be done within a certain time, before Level 2 support is consulted. Here, the scope of the timer (i.e., which activities must be done in time) is constrained by the subprocess.
A subprocess is defined by the subprocess element. All activities, gateways, events, etc. that are part of the subprocess, need to be enclosed within this element.
<startEvent id="outerStartEvent" /> <!-- ... other elements ... --> <subProcess id="subProcess"> <startEvent id="subProcessStart" /> <!-- ... other subprocess elements ... --> <endEvent id="subProcessEnd" /> </subProcess>
|Attributes||camunda:asyncBefore, camunda:asyncAfter, camunda:exclusive, camunda:jobPriority|
|Extension Elements||camunda:failedJobRetryTimeCycle, camunda:inputOutput|