Skip to content

Event-Based Gateway

An event-based gateway is a decision point in a process model (see BPMN Gateway). It does not look at data. It routes by which event takes place next.

Compare it with the data-based exclusive gateway. That gateway decides from available data, such as a chosen recipe, and follows only one path. The event-based gateway decides from events.

How it works

  • The process waits at the gateway.
  • Each outgoing flow leads to an event or a receive task.
  • The first event that is triggered selects its outgoing flow.
  • No other event of that gateway can be triggered afterward. Exactly one branch runs (XOR semantics).

Which elements may follow

Not every intermediate event can follow an event-based gateway (see Intermediate Event). In Camunda 8, each outgoing flow must lead to an intermediate catch event of type timer, message or signal. Receive tasks can also be combined with the gateway.

A timer is a typical way to handle a reply that never comes. One branch waits for the expected message. Another branch fires when time runs out.

A customer orders a pizza and waits. Two branches follow the gateway. One catches a “pizza delivered” message, and the customer eats. The other is a 60-minute timer, after which the customer makes an anxious phone call.

If the pizza arrives first, the timer can no longer fire. If the timer fires first, the delivery branch can no longer be taken.

Only certain elements may follow the gateway, so some intermediate events cannot be modeled directly after it. Tool rules can be narrower than the general idea. Camunda 8, for example, lists only timer, message and signal catch events.

Because the first event wins, the other events are ignored once one has fired.

After ordering, the process waits for either the delivery message or a 60-minute timer. The first event decides the path.

Diagram source
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" targetNamespace="http://example.com/bpmn">
<message id="msgDelivered" name="Pizza delivered" />
<process id="orderPizza" isExecutable="false">
<startEvent id="start" name="Hungry">
<outgoing>f1</outgoing>
</startEvent>
<task id="order" name="Order pizza">
<incoming>f1</incoming>
<outgoing>f2</outgoing>
</task>
<eventBasedGateway id="gw">
<incoming>f2</incoming>
<outgoing>f3</outgoing>
<outgoing>f4</outgoing>
</eventBasedGateway>
<intermediateCatchEvent id="delivered" name="Pizza delivered">
<incoming>f3</incoming>
<outgoing>f5</outgoing>
<messageEventDefinition messageRef="msgDelivered" />
</intermediateCatchEvent>
<intermediateCatchEvent id="timeout" name="60 minutes">
<incoming>f4</incoming>
<outgoing>f6</outgoing>
<timerEventDefinition>
<timeDuration>PT60M</timeDuration>
</timerEventDefinition>
</intermediateCatchEvent>
<task id="eat" name="Eat pizza">
<incoming>f5</incoming>
<outgoing>f7</outgoing>
</task>
<task id="call" name="Call restaurant">
<incoming>f6</incoming>
<outgoing>f8</outgoing>
</task>
<endEvent id="end">
<incoming>f7</incoming>
<incoming>f8</incoming>
</endEvent>
<sequenceFlow id="f1" sourceRef="start" targetRef="order" />
<sequenceFlow id="f2" sourceRef="order" targetRef="gw" />
<sequenceFlow id="f3" sourceRef="gw" targetRef="delivered" />
<sequenceFlow id="f4" sourceRef="gw" targetRef="timeout" />
<sequenceFlow id="f5" sourceRef="delivered" targetRef="eat" />
<sequenceFlow id="f6" sourceRef="timeout" targetRef="call" />
<sequenceFlow id="f7" sourceRef="eat" targetRef="end" />
<sequenceFlow id="f8" sourceRef="call" targetRef="end" />
</process>
<bpmndi:BPMNDiagram id="BPMNDiagram_orderPizza">
<bpmndi:BPMNPlane id="BPMNPlane_orderPizza" bpmnElement="orderPizza">
<bpmndi:BPMNShape id="BPMNShape_start" bpmnElement="start">
<dc:Bounds x="80" y="102" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="74" y="143" width="48" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_order" bpmnElement="order">
<dc:Bounds x="216" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_gw" bpmnElement="gw" isMarkerVisible="true">
<dc:Bounds x="416" y="95" width="50" height="50" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_delivered" bpmnElement="delivered">
<dc:Bounds x="566" y="102" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="551" y="143" width="67" height="28" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_timeout" bpmnElement="timeout">
<dc:Bounds x="566" y="262" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="547" y="303" width="74" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_eat" bpmnElement="eat">
<dc:Bounds x="702" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_call" bpmnElement="call">
<dc:Bounds x="702" y="240" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_end" bpmnElement="end">
<dc:Bounds x="902" y="102" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_f1" bpmnElement="f1">
<di:waypoint x="116" y="120" />
<di:waypoint x="216" y="120" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_f2" bpmnElement="f2">
<di:waypoint x="316" y="120" />
<di:waypoint x="416" y="120" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_f3" bpmnElement="f3">
<di:waypoint x="466" y="120" />
<di:waypoint x="566" y="120" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_f5" bpmnElement="f5">
<di:waypoint x="602" y="120" />
<di:waypoint x="702" y="120" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_f7" bpmnElement="f7">
<di:waypoint x="802" y="120" />
<di:waypoint x="902" y="120" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_f4" bpmnElement="f4">
<di:waypoint x="441" y="145" />
<di:waypoint x="441" y="280" />
<di:waypoint x="566" y="280" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_f6" bpmnElement="f6">
<di:waypoint x="602" y="280" />
<di:waypoint x="702" y="280" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_f8" bpmnElement="f8">
<di:waypoint x="802" y="280" />
<di:waypoint x="920" y="280" />
<di:waypoint x="920" y="138" />
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>
  • Each outgoing flow of an event-based gateway leads to an event or receive task, not to a decision based on data.
  • If the target is Camunda 8, every outgoing flow of the event-based gateway ends at a timer, message or signal intermediate catch event.
  • Decisions based on data use a data-based exclusive gateway, not an event-based gateway.