Skip to Content
BPMN ElementsGatewaysExclusive (XOR)

Exclusive Gateway (XOR)

Routes execution to exactly one outgoing path based on conditions.

<exclusiveGateway id="checkAmount" name="Amount OK?" default="rejectFlow" /> <sequenceFlow id="approveFlow" sourceRef="checkAmount" targetRef="approve"> <conditionExpression>${amount} > 0</conditionExpression> </sequenceFlow> <sequenceFlow id="rejectFlow" sourceRef="checkAmount" targetRef="reject" />

Decision algorithm

The engine evaluates outgoing flows in document order:

  1. For each flow that has a condition expression: evaluate the condition against current variables
  2. The first flow whose condition evaluates to true is taken — remaining flows are not evaluated
  3. If no conditional flow matched and an unconditioned flow exists, that flow is taken
  4. If no conditional flow matched but a default flow is configured (default attribute), the default flow is taken
  5. If nothing matched: the instance transitions to Failed with a NoMatchingCondition error

Order matters. Conditions are evaluated in the order they appear in the XML, so place more specific conditions before broader ones.

Condition expression syntax

Operators: == != > < >= <= && || ! Variable reference: ${varName} or varName Literal values: "string" 'string' 123 3.14 true false null Examples: ${amount} > 0 status == 'approved' && amount < 1000 !rejected

Type coercion rules:

  • "42" == 42true (string coerced to number for comparison)
  • 2 == 2.0true (integer and float compared as float)
  • An undefined variable evaluates to false (logged as a warning)
Last updated on