Skip to main content

Gateways and Sequence Flows

When a token leaves a node, the engine decides which outgoing sequence flows it takes. This page covers how that decision is made: conditions and default flows on any node, the four gateway types that split and merge tokens, what each one waits for at a join, and what validation rejects at deploy. For an introduction to the notation itself, see What is BPMN?.

SymbolElementAt a splitAt a join
BPMN exclusive gateway symbolExclusive gatewayOne flow: the first condition that is true, else the defaultPasses every token straight through
BPMN parallel gateway symbolParallel gatewayEvery outgoing flowWaits for a token on every incoming flow
BPMN inclusive gateway symbolInclusive gatewayEvery flow whose condition is true, else the defaultWaits until no other token can still arrive
BPMN event-based gateway symbolEvent-based gatewayThe flow behind the first event that happensNot used as a join
BPMN sequence flow symbolSequence flowCarries the token to the next node
BPMN conditional flow symbolConditional flowTaken when its condition is true
BPMN default flow symbolDefault flowTaken when no other flow is

Sequence flows​

Sequence flows connect events, tasks, gateways and sub-processes within one process. A flow carries a token from its source to its target.

Attributes​

AttributeRequiredNotes
idyesUnique flow identifier
namenoDisplay label
sourceRefyesID of the source node
targetRefyesID of the target node

Conditions​

A <conditionExpression> child holds a FEEL expression that is evaluated when the token leaves a node with more than one outgoing flow. The flow is taken when the expression returns true. Write it with a leading =, as every FEEL field in a process: the engine also reads a condition without one, but = is the canonical form.

<bpmn:sequenceFlow id="f1" name="price &gt; 0" sourceRef="svc1" targetRef="task-success">
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">=price &gt; 0</bpmn:conditionExpression>
</bpmn:sequenceFlow>

Conditions are evaluated on flows that leave:

  • Exclusive (XOR) gateways, where the first matching flow in document order is taken.
  • Inclusive (OR) gateways, where every matching flow is taken in parallel.
  • Activities, where every matching flow is taken in parallel (an uncontrolled fork, BPMN 2.0 §13.2.1).

An activity evaluates the condition on its only outgoing flow too, and a false condition with no default raises an incident. Events take their outgoing flows without evaluating conditions.

Default flows​

A node with several outgoing flows can mark one of them as the default with default="<flowId>". The default flow is taken only when no other outgoing flow is. The engine reads default on:

  • exclusive and inclusive gateways
  • tasks of every type (service, user, script, business rule, send, receive, manual, generic)
  • embedded and ad-hoc sub-processes
  • call activities

A default flow must not carry a <conditionExpression> of its own.

<!-- Exclusive gateway with a default -->
<bpmn:exclusiveGateway id="gw1" default="f-fallback">
<bpmn:outgoing>f-vip</bpmn:outgoing>
<bpmn:outgoing>f-fallback</bpmn:outgoing>
</bpmn:exclusiveGateway>

<bpmn:sequenceFlow id="f-vip" sourceRef="gw1" targetRef="task-vip">
<bpmn:conditionExpression>=tier = "vip"</bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:sequenceFlow id="f-fallback" sourceRef="gw1" targetRef="task-default" />
<!-- Service task with a default: the same routing without a separate gateway -->
<bpmn:serviceTask id="route" default="f-default">
<bpmn:extensionElements>
<quantum:taskDefinition type="route-task" />
</bpmn:extensionElements>
<bpmn:outgoing>f-route-vip</bpmn:outgoing>
<bpmn:outgoing>f-default</bpmn:outgoing>
</bpmn:serviceTask>

How outgoing flows are selected​

When a token leaves a node with several outgoing flows, the engine evaluates them in two passes:

  1. Non-default flows. Each flow whose condition returns true emits a token. A flow without a <conditionExpression> counts as always true. The default flow is skipped in this pass.
  2. Default fallback. If the first pass emitted no token and the node declares a default flow, the default emits one.

If neither pass emits a token, the node raises an incident and the instance waits there until an operator resolves it.

Source nodeSeveral non-default flows matchNo non-default flow matchesOnly an unconditional default
Exclusive gateway (XOR)The first match in document order, the rest are skippedThe default if declared, otherwise an incidentThe default
Inclusive gateway (OR)Every match, in parallelThe default if declared, otherwise an incidentThe default
ActivityEvery match, in parallel (uncontrolled fork)The default if declared, otherwise an incidentThe default
Parallel gateway (AND)Every outgoing flow, conditions are ignoredn/an/a

Three-way example​

A service task with three outgoing flows:

  • f-cond with the condition =x > 0, to task-positive
  • f-uncond with no condition, to task-always
  • f-default, declared as default, to task-fallback
<bpmn:serviceTask id="route" default="f-default">
<bpmn:extensionElements>
<quantum:taskDefinition type="route-task" />
</bpmn:extensionElements>
<bpmn:outgoing>f-cond</bpmn:outgoing>
<bpmn:outgoing>f-uncond</bpmn:outgoing>
<bpmn:outgoing>f-default</bpmn:outgoing>
</bpmn:serviceTask>

<bpmn:sequenceFlow id="f-cond" sourceRef="route" targetRef="task-positive">
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">=x &gt; 0</bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:sequenceFlow id="f-uncond" sourceRef="route" targetRef="task-always" />
<bpmn:sequenceFlow id="f-default" sourceRef="route" targetRef="task-fallback" />
xf-cond (x > 0)f-uncond (no condition)f-defaultResult
5true, emitsalways true, emitsskippedTwo parallel tokens: task-positive and task-always
-1falsealways true, emitsskippedOne token: task-always

The default flow here can never fire: f-uncond emits on every visit, so the fallback pass never runs. The validator does not flag this on activities, so look for it in review. To make the default reachable, give f-uncond a condition that can be false, or remove it.

Sequence flow validation​

CheckSeverity
Default flow ID isn't one of the source node's outgoing flowsError
Default flow carries a conditionExpressionError
Start event has an incoming sequence flowError
End event has an outgoing sequence flowError
Intermediate catch event does not have exactly one outgoing sequence flowError
Boundary event (other than compensation) has no outgoing sequence flowError
Activity marked isForCompensation="true" has incoming flowsError

Gateway attributes​

AttributeNotes
idRequired
nameOptional
defaultFlow ID of the fallback flow taken when no condition matches (exclusive and inclusive only)
gatewayDirectionInformational, not enforced

A default flow must be one of the gateway's outgoing flows and must not carry a conditionExpression.


Exclusive gateway (XOR)​

BPMN exclusive gateway symbol

Takes exactly one outgoing flow at a split: the first flow whose condition is true, or the default when none is. Used as a join it merges alternative paths without waiting, so every incoming token passes straight through.

An exclusive gateway routes orders over 1000 to a review task and every other order down the default flow to automatic approval, and a second exclusive gateway merges the two paths.An exclusive gateway routes orders over 1000 to a review task and every other order down the default flow to automatic approval, and a second exclusive gateway merges the two paths.
Orders over 1000 go to review, everything else takes the default flow. The second gateway merges the paths without waiting.

Behavior​

ScenarioBehavior
Split with conditionsFlows are evaluated in document order. The first true wins and the flows after it are not evaluated
Split with no match and a defaultThe default flow is taken
Split with no match and no defaultIncident on the gateway
JoinPass-through, every incoming token advances

Example​

<bpmn:exclusiveGateway id="gw-route" name="Amount?" default="flow-auto">
<bpmn:incoming>f1</bpmn:incoming>
<bpmn:outgoing>flow-review</bpmn:outgoing>
<bpmn:outgoing>flow-auto</bpmn:outgoing>
</bpmn:exclusiveGateway>

<bpmn:sequenceFlow id="flow-review" name="amount &gt; 1000" sourceRef="gw-route" targetRef="review">
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">=amount &gt; 1000</bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:sequenceFlow id="flow-auto" name="default" sourceRef="gw-route" targetRef="approve" />

Validation​

CheckSeverity
default doesn't match an outgoing flowError
Default flow carries a conditionExpressionError
Non-default outgoing flow has no condition (when default is set)Warning
Several outgoing flows, no default, and a flow without a conditionWarning
Gateway with at most one incoming and one outgoing flow, so it neither merges nor splitsError

Parallel gateway (AND)​

BPMN parallel gateway symbol

Splits into every outgoing flow at once, and joins by waiting for a token on every incoming flow.

A parallel gateway starts picking items and printing the label at the same time, and a second parallel gateway waits for both before the order ships.A parallel gateway starts picking items and printing the label at the same time, and a second parallel gateway waits for both before the order ships.
Both branches start together. Ship order runs only after both have arrived at the join.

Behavior​

ScenarioBehavior
SplitEvery outgoing flow is activated. Conditions are not evaluated
JoinWaits until a token has arrived on every incoming flow, then emits a single outgoing token

A condition on an outgoing flow is ignored, and deployment reports a warning.

Example​

<bpmn:parallelGateway id="fork">
<bpmn:incoming>f1</bpmn:incoming>
<bpmn:outgoing>f2</bpmn:outgoing>
<bpmn:outgoing>f3</bpmn:outgoing>
</bpmn:parallelGateway>

<!-- ... tasks in parallel branches ... -->

<bpmn:parallelGateway id="join">
<bpmn:incoming>f2-done</bpmn:incoming>
<bpmn:incoming>f3-done</bpmn:incoming>
<bpmn:outgoing>f4</bpmn:outgoing>
</bpmn:parallelGateway>

Validation​

CheckSeverity
Outgoing flow carries a conditionExpressionWarning (the condition is ignored)
Gateway with at most one incoming and one outgoing flow, so it neither merges nor splitsError

Inclusive gateway (OR)​

BPMN inclusive gateway symbol

Takes every outgoing flow whose condition is true. The matching join waits for all of those branches, and only those.

An inclusive gateway sends an SMS when smsOptIn is true and a push notification when pushOptIn is true, falls back to email by default, and a second inclusive gateway joins the branches.An inclusive gateway sends an SMS when smsOptIn is true and a push notification when pushOptIn is true, falls back to email by default, and a second inclusive gateway joins the branches.
Each opt-in that is true starts its branch. Email is the default and runs only when neither opt-in is set.

Behavior​

ScenarioBehavior
SplitEvery matching condition activates its flow in parallel. With no match the default fires, and with no match and no default the gateway raises an incident
JoinWaits for every branch that can still reach it, then merges branch variables into the parent scope and advances once

When the join fires​

The join does not count incoming flows. It fires when at least one token has arrived and no other token in the same scope can still reach it. In the diagram above:

smsOptInpushOptInBranches that runThe join fires
truetrueSend SMS, Send pushWhen the slower of the two finishes
truefalseSend SMSAs soon as Send SMS finishes
falsefalseSend email (default)As soon as Send email finishes

Because the rule is about reachability, it also holds when the split and join are not paired one to one: loops, nested gateways and branches that end early do not keep the join waiting for a token that can never come.

Example​

<bpmn:inclusiveGateway id="gw-or" name="Channels?" default="flow-email">
<bpmn:incoming>f1</bpmn:incoming>
<bpmn:outgoing>flow-sms</bpmn:outgoing>
<bpmn:outgoing>flow-push</bpmn:outgoing>
<bpmn:outgoing>flow-email</bpmn:outgoing>
</bpmn:inclusiveGateway>

<bpmn:sequenceFlow id="flow-sms" sourceRef="gw-or" targetRef="send-sms">
<bpmn:conditionExpression>=smsOptIn</bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:sequenceFlow id="flow-push" sourceRef="gw-or" targetRef="send-push">
<bpmn:conditionExpression>=pushOptIn</bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:sequenceFlow id="flow-email" sourceRef="gw-or" targetRef="send-email" />

Validation​

CheckSeverity
default doesn't match an outgoing flowError
Default flow carries a conditionExpressionError
Non-default outgoing flow has no condition (when default is set)Warning
Several outgoing flows, no default, and a flow without a conditionWarning
Gateway with at most one incoming and one outgoing flow, so it neither merges nor splitsError

Event-based gateway​

BPMN event-based gateway symbol

Waits for the first of several events and takes the branch behind it. Each outgoing flow must lead directly to an intermediate catch event with a message, timer or signal trigger.

After the invoice is sent, an event-based gateway waits for either a payment received message or a 7 day timer. Payment leads to shipping, the timer leads to cancelling the order.After the invoice is sent, an event-based gateway waits for either a payment received message or a 7 day timer. Payment leads to shipping, the timer leads to cancelling the order.
Whichever happens first wins: the payment message ships the order, the 7 day timer cancels it, and the other wait is dropped.

Attributes​

AttributeDefaultNotes
instantiatefalseNot supported. Deployment fails with an error if set to true
eventGatewayTypeExclusiveOnly Exclusive (first event wins) is implemented. Parallel deploys without error but runs as Exclusive

Behavior​

ScenarioBehavior
First event firesThe winning branch advances, every other branch is cancelled. A winning catch event without an output mapping writes the message or signal payload to the process variables, as a catch event on its own does
No event firesThe token waits indefinitely. Add a timer branch to bound the wait

To let every event that fires advance its own branch, use a parallel gateway followed by separate catch events instead.

Example​

<bpmn:eventBasedGateway id="gw-event" name="First to happen?">
<bpmn:incoming>f1</bpmn:incoming>
<bpmn:outgoing>flow-msg</bpmn:outgoing>
<bpmn:outgoing>flow-timer</bpmn:outgoing>
</bpmn:eventBasedGateway>

<bpmn:sequenceFlow id="flow-msg" sourceRef="gw-event" targetRef="catch-paid" />
<bpmn:intermediateCatchEvent id="catch-paid" name="Payment received">
<bpmn:incoming>flow-msg</bpmn:incoming>
<bpmn:outgoing>f-ship</bpmn:outgoing>
<bpmn:messageEventDefinition messageRef="Msg_Paid" />
</bpmn:intermediateCatchEvent>

<bpmn:sequenceFlow id="flow-timer" sourceRef="gw-event" targetRef="catch-timeout" />
<bpmn:intermediateCatchEvent id="catch-timeout" name="7 days">
<bpmn:incoming>flow-timer</bpmn:incoming>
<bpmn:outgoing>f-cancel</bpmn:outgoing>
<bpmn:timerEventDefinition>
<bpmn:timeDuration xsi:type="bpmn:tFormalExpression">P7D</bpmn:timeDuration>
</bpmn:timerEventDefinition>
</bpmn:intermediateCatchEvent>

Validation​

CheckSeverity
Fewer than 2 outgoing flowsError
No incoming flowError
instantiate="true" set on the gatewayError
Outgoing flow leads to a node that isn't an intermediate catch eventError
Catch event trigger isn't message, signal, or timerError
Outgoing flow carries a conditionExpressionError

FAQ​

What's the difference between exclusive, parallel, and inclusive gateways in BPMN?

An exclusive (XOR) gateway takes exactly one outgoing flow at a split - the first whose condition returns true, or the default if none match. A parallel (AND) gateway takes every outgoing flow unconditionally, and at a join waits until a token has arrived on every incoming branch. An inclusive (OR) gateway takes every outgoing flow whose condition is true (or the default if none match), and its matching join waits until at least one branch has arrived and no other live token in scope can still reach it.

What happens at an exclusive gateway when no outgoing condition matches?

If the gateway has a default flow, the default flow is taken. If it has none, the gateway raises an incident and the instance waits there until an operator resolves it. Conditions are evaluated in the order the outgoing flows appear in the BPMN XML, and the first to return true wins.

What is a default flow in BPMN and when does it fire?

A default flow is the fallback outgoing flow, taken when no other outgoing flow of the node is. Declare it with default="<flowId>" on the source node. The flow itself must not carry a conditionExpression, and the validator rejects a default flow that has one. The engine reads default on exclusive and inclusive gateways, on every kind of task, on embedded and ad-hoc sub-processes, and on call activities.

Why might my default flow never fire?

A non-default outgoing flow without a conditionExpression counts as always true and emits a token on every visit. The default only fires when every non-default flow evaluates to false, so an unconditional sibling makes it unreachable. On exclusive and inclusive gateways the validator reports this combination as a warning.

Can a BPMN task have multiple outgoing flows with conditions?

Yes. An activity with several outgoing flows is an uncontrolled fork (BPMN 2.0 §13.2.1): every flow whose condition evaluates to true emits a token, so several matches fan out into parallel branches. Conditions plus a default flow on a task behave like an inclusive gateway, which lets you route from a task without a separate gateway node. When no condition matches and there is no default, the task raises an incident. For exactly one path, use an exclusive gateway.

What happens to a sequence flow without a condition expression?

From a node with one outgoing flow, the flow is always taken. From a node with several outgoing flows it counts as always true on activities and inclusive gateways, so it emits a token on every visit. On parallel gateways that is the normal case, since they ignore conditions anyway. On an exclusive gateway an unconditional non-default flow wins every time it is reached, so any flow after it in document order is unreachable.

What's the difference between a sequence flow and a message flow in BPMN?

A sequence flow is the solid arrow that connects flow nodes within one process. It carries tokens at runtime and defines the order of execution. A message flow is a dashed arrow in a collaboration diagram between two participants, showing that one sends a message to the other. The modeler reads and writes message flows, but the engine does not act on them: message delivery happens through message throw events, send tasks, catch events, receive tasks and correlation.

What happens if a parallel gateway join receives a token on only some of its incoming flows?

The join waits. A parallel join fires once a token has arrived on every incoming sequence flow. If one branch never produces a token, for example because an upstream task failed and was not compensated, the join waits indefinitely. Use a timer boundary event on the surrounding scope to bound the wait.

How does an inclusive (OR) join decide when to fire?

The inclusive join fires as soon as at least one branch has arrived and no other live token in the enclosing scope can still reach the join without first passing through it. This reachability check handles loops, nested gateways and asymmetric splits. The join does not need to know which split created the incoming tokens, and tokens in parts of the process that cannot reach it do not keep it waiting.

What can come after an event-based gateway?

Each outgoing flow must lead directly to an intermediate catch event with a message, signal, or timer trigger. Tasks, gateways and other element types are rejected at deployment, and so are conditional, multiple and parallel-multiple catch events.

Can an event-based gateway start a process instance (`instantiate="true"`)?

No. The instantiating event gateway is not supported, and deployment fails with a validation error when instantiate is true. To start an instance from an event, use a message start event or a signal start event on the process.

Does QuantumBPM support the BPMN complex gateway?

No. The complex gateway is rejected at deployment by both the modeler and the engine. Most uses, such as continuing when 2 of 3 branches arrive, can be modeled with an exclusive or inclusive gateway and FEEL conditions on the outgoing flows, or with a script task that computes the routing decision.

Can an exclusive gateway be used as a join to merge multiple branches?

Yes. As a join, an exclusive gateway is a pass-through merge: every incoming token advances on its own, with no synchronisation. It is the standard way to bring alternative branches from an exclusive split back onto one path.