Event Subprocess

An event subprocess is a subprocess that is triggered by an event. It can be added globally to the process or locally inside an embedded subprocess.

event-subprocess

An event subprocess must have exactly one start event of type timer or message. Other start events are not allowed.

An event subprocess behaves like a boundary event but is inside the scope instead of being attached to the scope. Like a boundary event, the event subprocess can be interrupting or non-interrupting (indicated in BPMN by a solid or dashed border of the start event). The start event of the event subprocess can be triggered when its containing scope is activated.

A non-interrupting event subprocess can be triggered multiple times. An interrupting event subprocess can be triggered only once.

When an interrupting event subprocess is triggered then all active instances of its containing scope are terminated, including instances of other non-interrupting event subprocesses.

If an event subprocess is triggered then its containing scope is not completed until the triggered instance is completed.

Variables

Unlike a boundary event, an event subprocess is inside the scope. So, it can access and modify all local variables of its containing scope. This is not possible with a boundary event because a boundary event is outside of the scope.

Input mappings can be used to create new local variables in the scope of the event subprocess. These variables are only visible within the event subprocess.

By default, the local variables of the event subprocess are not propagated (i.e. they are removed with the scope). This behavior can be customized by defining output mappings at the event subprocess. The output mappings are applied on completing the event subprocess.

Additional Resources

XML representation

An event subprocess with an interrupting timer start event:

<bpmn:subProcess id="compensate-subprocess" triggeredByEvent="true">
  <bpmn:startEvent id="cancel-order" isInterrupting="true">
    <bpmn:timerEventDefinition>
      <bpmn:timeDuration>PT5M</bpmn:timeDuration>
    </bpmn:timerEventDefinition>
  ... other elements
</bpmn:subProcess>

Using the BPMN modeler

Adding an event subprocess with an interrupting timer start event:

event-subprocess

Workflow Lifecycle

Workflow instance records of an event subprocess with an interrupting timer start event:

Intent Element Id Element Type
EVENT_OCCURRED five-minutes START_EVENT
ELEMENT_TERMINATING fetch-item SERVICE_TASK
... ... ...
ELEMENT_TERMINATED fetch-item SERVICE_TASK
ELEMENT_ACTIVATING compensate-subprocess SUB_PROCESS
ELEMENT_ACTIVATED compensate-subprocess SUB_PROCESS
ELEMENT_ACTIVATING five-minutes START_EVENT
... ... ...
ELEMENT_COMPLETED order-cancelled END_EVENT
ELEMENT_COMPLETING compensate-subprocess SUB_PROCESS
ELEMENT_COMPLETED compensate-subprocess SUB_PROCESS
ELEMENT_COMPLETING order-process PROCESS
ELEMENT_COMPLETED order-process PROCESS

References: