Escalation events are events which reference a named escalation. They are mostly used to communicate from a subprocess to an upper process. Unlike an error, an escalation event is non critical and execution continues at the location of throwing.
Defining Escalation
An escalation event definition is declared by using the escalationEventDefinition
element. The attribute escalationRef
references an escalation
element declared as a child element of the definitions root element. The following is an excerpt of a process in which an escalation event is declared and referenced by an escalation intermediate throw event.
<definitions>
<escalation id="lateShipment" escalationCode="ORDER-LATE-SHIPMENT" />
<!-- ... -->
<process>
<!-- ... -->
<intermediateThrowEvent id="throwEscalation" name="late shipment">
<escalationEventDefinition escalationRef="lateShipment" />
</intermediateThrowEvent>
<!-- ... -->
</process>
</definitions>
Catching Escalation Events
Escalation Start Event
An escalation start event can only be used to trigger an event sub-process - it cannot be used to start a process instance.
An event sub-process with an escalation start event is triggered by an escalation event that occurs in the same scope or in a lower scope (e.g., sub-process or call activity). When the sub-process is triggered by an escalation event from a call activity, then the defined output variables of the call activity are passed to the sub-process.
Two optional attributes can be added to the escalation start event, escalationRef
and escalationCodeVariable
:
<subprocess triggeredByEvent="true">
<startEvent id="catchEscalation" isInterrupting="false">
<escalationEventDefinition camunda:escalationCodeVariable="code"/>
</startEvent>
<!-- ... -->
</subprocess>
- If escalationRef is omitted or escalationCode of referenced escalation is omitted, the event sub-process is triggered by any escalation event, regardless of the escalation code of the escalation.
- In case an escalationRef is set, the event sub-process is only triggered by escalation events with the defined escalation code.
- If escalationCodeVariable is set, the escalation code of the occurred escalation event can be retrieved using this variable.
Current Limitations
- The escalation code of the start event must be unique across the event sub-processes of the same scope.
- If a start event has no escalationRef or escalationCode of referenced escalation then another event sub-process with an escalation start event is not supported.
Camunda Extensions
The following extensions are supported for escalationEventDefinition
.
Attributes |
---|
camunda:escalationCodeVariable |
Extension Elements |
——- |
– |
Constraints |
——- |
– |
Escalation Boundary Event
An intermediate catching escalation event on the boundary of an activity, or escalation boundary event for short, catches escalations that are thrown within the scope of the activity on which it is defined.
An escalation boundary event can only attached on an embedded sub-process or a call activity, since an escalation can only be thrown by an escalation intermediate throw event or an escalation end event. When the boundary event is triggered by an escalation event from a call activity, then the defined output variables of the call activity are passed to the scope of the boundary event.
Two optional attributes can be added to the escalation boundary event, escalationRef
and escalationCodeVariable
, see Escalation Start Event.
<boundaryEvent id="catchEscalation" name="late shipment" attachedToRef="productProcurement">
<escalationEventDefinition escalationRef="lateShipment" cancelActivity="false" />
</boundaryEvent>
Current Limitations
- The escalation code of the boundary event must be unique across the boundary events of the attached activity.
- If a boundary event has no escalationRef or escalationCode of referenced escalation then another escalation boundary event is not supported.
Camunda Extensions
The following extensions are supported for escalationEventDefinition
.
Attributes |
---|
camunda:escalationCodeVariable |
Extension Elements |
——- |
– |
Constraints |
——- |
– |
Throwing Escalation Events
Escalation Intermediate Throw Event
When process execution arrives at an escalation intermediate throw event, a named escalation is thrown. This escalation can be caught by an escalation boundary event or an event sub-process with an escalation start event which has the same or none escalation code.
Like an error event, an escalation event is propagated to upper scopes (e.g., from sub-process or call activity) till it is caught. In case no boundary event or event sub-process caught the event, the execution just continues with normal flow. If the escalation is propagated to an upper scope via call activity then the defined output variables of the call activity are passed to the upper scope.
<intermediateThrowEvent id="throwEscalation" name="order shipped">
<escalationEventDefinition escalationRef="orderShipped" />
</intermediateThrowEvent>
Escalation End Event
When process execution arrives at an escalation end event, the current path of execution is ended and a named escalation is thrown. It has the same behavior as an escalation intermediate throw event.
<endEvent id="throwEscalation" name="late shipment">
<escalationEventDefinition escalationRef="lateShipment" />
</endEvent>
原文: https://docs.camunda.org/manual/7.9/reference/bpmn20/events/escalation-events/