Gateways Overview
Gateways control the flow of execution in your BPMN processes. They determine which paths to take, when to split execution into parallel paths, and when to synchronize back together.
What Are Gateways?
In BPMN, gateways are decision points represented by diamond shapes. The BankLingo Process Engine supports three types of gateways, each serving a different purpose:
Gateway Types
🔀 Exclusive Gateway (XOR)
Symbol: ◇X or ◇ with X marker
Behavior: Choose exactly ONE path from multiple options
When to Use:
- Approve/Reject decisions
- Risk level routing (Low/Medium/High)
- Amount-based routing
- Any either/or decision
Example:
Learn more about Exclusive Gateways →
🔁 Parallel Gateway (AND)
Symbol: ◇+ with plus marker
Behavior: Execute ALL paths simultaneously, wait for ALL to complete
When to Use:
- Run multiple background checks in parallel
- Send notifications through multiple channels
- Collect data from multiple sources
- Any tasks that can run independently
Example:
Learn more about Parallel Gateways →
🔂 Inclusive Gateway (OR)
Symbol: ◇O with circle marker
Behavior: Activate ONE OR MORE paths based on conditions
When to Use:
- Send notifications (email always, SMS if available)
- Perform optional checks based on data
- Route to multiple teams conditionally
- Any scenario where multiple paths may be valid
Example:
Learn more about Inclusive Gateways →
Quick Comparison
| Feature | Exclusive (XOR) | Parallel (AND) | Inclusive (OR) |
|---|---|---|---|
| Paths Taken | Exactly 1 | All (always) | 1 or more |
| Conditions | Required | Not allowed | Optional |
| Use Conditions On | Gateway OR flows | N/A | Individual flows |
| Join Behavior | N/A (single path) | Wait for ALL | Wait for activated |
| Best For | Either/or decisions | Independent parallel tasks | Conditional parallel tasks |
| Example | Approve/Reject | Background checks | Multi-channel alerts |
Token-Based Execution
Starting with the latest implementation, Parallel and Inclusive Gateways use a token-based execution model:
How Tokens Work
- Single Token Start: Process begins with one execution token
- Split Creates Tokens: When a gateway splits, it creates a new token for each path
- Independent Execution: Each token executes its path independently
- Join Waits for Tokens: Join gateway waits for all tokens to arrive
- Merge and Continue: Tokens merge back into a single token after join
Example Flow
Benefits
- True Parallelism: Each path executes independently
- State Isolation: Each token tracks its own position and history
- Reliable Synchronization: Join gateways know exactly how many tokens to expect
- Debugging: Logs show each token's journey through the process
When to Use Which Gateway?
Decision Tree
Real-World Scenarios
Loan Approval (Exclusive)
<bpmn:exclusiveGateway id="Gateway_Amount">
<bpmn:extensionElements>
<custom:properties>
<custom:property name="Condition" value="
return amount > 50000 ? 'Flow_Senior' : 'Flow_Standard';
" />
</custom:properties>
</bpmn:extensionElements>
</bpmn:exclusiveGateway>
Result: Either senior approval OR standard approval (not both)
Background Checks (Parallel)
<bpmn:parallelGateway id="Gateway_Checks">
<bpmn:outgoing>Flow_Credit</bpmn:outgoing>
<bpmn:outgoing>Flow_Employment</bpmn:outgoing>
<bpmn:outgoing>Flow_Identity</bpmn:outgoing>
</bpmn:parallelGateway>
Result: All three checks run at the same time
Notifications (Inclusive)
<bpmn:inclusiveGateway id="Gateway_Notify">
<bpmn:outgoing>Flow_Email</bpmn:outgoing>
<bpmn:outgoing>Flow_SMS</bpmn:outgoing>
<bpmn:outgoing>Flow_Push</bpmn:outgoing>
</bpmn:inclusiveGateway>
<bpmn:sequenceFlow id="Flow_SMS" sourceRef="Gateway_Notify" targetRef="Task_SMS">
<bpmn:conditionExpression>hasPhone === true</bpmn:conditionExpression>
</bpmn:sequenceFlow>
Result: Email always + SMS if customer has phone + Push if customer has app
Common Patterns
Pattern 1: Simple Branching
Pattern 2: Parallel Execution
Pattern 3: Conditional Parallel
Pattern 4: Nested Gateways
Next Steps
- New to Gateways? → Start with Exclusive Gateway (simplest)
- Need Parallel Execution? → See Parallel Gateway
- Conditional Parallelism? → Check Inclusive Gateway
- Real Examples? → Browse Use Cases
- Having Issues? → Visit Troubleshooting
Execution Logs
All gateways produce detailed logs to help you understand and debug flow decisions:
[GATEWAY] Evaluating exclusive gateway: Gateway_Amount
[GATEWAY] Available paths: 2
[GATEWAY] → Flow_Senior: 'Senior Approval' → Task_SeniorReview
[GATEWAY] → Flow_Standard: 'Standard Approval' → Task_StandardReview (DEFAULT)
[GATEWAY] Executing gateway-level condition script
[GATEWAY] ✓ Condition script returned: 'Flow_Senior'
[GATEWAY] ✓ DECISION: Taking flow 'Flow_Senior' → Task_SeniorReview
Check your process execution logs to see exactly how gateways are making decisions in your processes.
Best Practices
✅ DO:
- Set default flows on Exclusive and Inclusive gateways
- Use descriptive names for flows:
"High Value (>$100k)"not"Flow_1" - Keep conditions simple - complex logic goes in ScriptTask before gateway
- Match split/join pairs - split 3 ways must join 3 ways
- Check execution logs to understand gateway decisions
❌ DON'T:
- Don't add conditions to Parallel Gateway flows (all paths always execute)
- Don't forget default flows on Exclusive/Inclusive gateways
- Don't use complex expressions in conditions (hard to debug)
- Don't mismatch token counts between split and join
- Don't forget to complete all parallel paths (join will wait forever)