In BPMN, a sub-process is a compound activity that represents a collection of other tasks and sub-processes. Generally, we create BPMN diagrams to communicate processes with others. To facilitate effective communications, we really do not want to make a business process diagram too complex. By using sub-processes, you can split a complex process into multiple levels, which allows you to focus on a particular area in a single process diagram.
BPMN specifies five types of markers for Sub-Processes. We will go cover each of them in the sections below.
A Sub-Process with a loop marker indicates that the sub-process repeats itself in sequence.
Use when you need to repeat one or more activities while preserving the data/results of the activities for future reference. Also very useful when you need to deal with multiple exceptional conditions that might interrupt the loop iterations.
In the following example, I am using the simple “check mail” process. Every hour I check the mail, and if there is something in the mailbox I reply to the mail. When I’m done replying to the new mail the cycle repeats. Immediately after replying to mail I go back to check for new mail. This starts to optimize the process because if new mail arrives while I’m replying to other mail, as soon as I’m finished replying there is no wait state.
The individual cycles of a loop task must follow each other. If for example we live in a flat-sharing community and the roommates feel like eating pizza, the “choose pizza” task must be repeated for each roommate before we can order. You’d sit together and pass a menu around until finally, everyone has made a decision. It is much more efficient for all roommates to look at the menu at once, and they choose a pizza together. You can model this process using the “multiple task” (see below). A multiple task instantiates repeatedly and can be executed in sequence or in parallel, with the latter being the more interesting case.
A Sub-Process with Multi-Instance marker indicates that the sub-process can run with other identical sub-processes simultaneously.
Compensation / Compensation & Multi-Instance / Compensation & Loop
The compensation task type is applied exclusively in the context of a compensation event. Accordingly, it is integrated in the process diagram only by associations, never by sequence flows.
The possible combination of the compensation with a loop or multiple instance as shown below is worth mentioning.
In this case, both markers are placed in parallel. As with the other markers, the compensation can be combined with the task types already introduced. A manual compensation task that repeats until it succeeds or that executes repeatedly and in parallel as far as possible, is therefore eminently practical.
A Sub-Process with Compensation Marker and Multi-Instance marker indicates that the sub-process can run with the compensation actions with multi-instance sub-processes simultaneously.
A Sub-Process with Ad-Hoc marker represents a collection of tasks that exist solely for handling a specific case. Use the ad-hoc sub-process to mark a segment in which the contained activities (tasks or sub-processes) can be:
- Executed in any order,
- Executed several times, or
Recognize it by the tilde character as shown in the diagram below: