jBPM Workflow Tutorial: 🔀 All Gateways Explained

🚀 Introduction

Gateways in jBPM are decision and control nodes that define how process flows diverge and converge. They allow workflows to branch, merge, or synchronize.

In this blog, we’ll explore all major gateways with examples:

  • Exclusive (XOR): pick one path

  • 🟢 Inclusive (OR): pick one or many

  • Parallel (AND): run all paths in parallel

  • Event-Based: wait for external events

  • ⚙️ Complex: advanced conditions/synchronization

🛠️ Prerequisites


❌ Exclusive Gateway (XOR)

📌 Purpose

Chooses one outgoing path based on conditions.

🎨 Example Flow

🔵 Start → 👤 Human Task → ❌ Gateway → ✅ Approve End / ❌ Reject End

⚙️ Condition Example

approved == true

or

approved == false

👉 Use when only one path should be taken.


🟢 Inclusive Gateway (OR)

📌 Purpose

Can take one or multiple outgoing paths depending on conditions.

🎨 Example Flow

🔵 Start → 🌀 Gateway → 📧 Email / 👤 Review / ✅ End

⚙️ Condition Example

  • If sendEmail == true → 📧 path

  • If reviewNeeded == true → 👤 Review path

  • Both can trigger at once.

👉 Use when more than one branch may execute simultaneously.


➕ Parallel Gateway (AND)

📌 Purpose

Splits the process into multiple parallel paths, no conditions required.

🎨 Example Flow

🔵 Start → ➕ Gateway → 📊 Report Task & 📧 Email Task → ➕ Join → ✅ End

👉 Use when tasks must happen at the same time (e.g., notify & generate report).


⏳ Event-Based Gateway

📌 Purpose

Waits for events and chooses a path depending on which event occurs first.

🎨 Example Flow

🔵 Start → ⏳ Event Gateway → 📩 Message Event / ⏰ Timer Event → ✅ End

👉 Use when process flow depends on external events (e.g., user reply or timeout).


⚙️ Complex Gateway

📌 Purpose

Used for advanced synchronization logic (rare in simple processes).

🎨 Example Flow

  • Wait for 2 of 3 incoming paths before continuing.

👉 Use only when other gateways cannot model the behaviour.

👉 Watch jBPM Gateway Examples Practical in Action better:

Here's a quick video to help you understand jBPM Gateway Examples in Action better: jBPM Gateways Tutorial in Hindi | Exclusive, Inclusive & Parallel Explained

👉 Source code: https://github.com/LearnITWithShikha/GatewayExamples


📊 Quick Comparison of Gateways

GatewaySymbolBehaviorExample Use Case
❌ Exclusive (XOR)  One path only        Approve/Reject decision
🟢 Inclusive (OR)  One or many paths         Send email AND/OR request review
➕ Parallel (AND)  All paths in parallel        Run reporting + notification together
⏳ Event-Based  Waits for event        User response OR timeout
⚙️ Complex  Advanced logic                Custom join
        (e.g., 2 of 3 tasks complete)

🎯 Conclusion

Gateways are the decision-makers of jBPM processes.

  • Exclusive → pick one path

  • 🟢 Inclusive → pick one or many

  • Parallel → run all paths in parallel

  • Event-Based → wait for external events

  • ⚙️ Complex → advanced conditions

By mastering gateways, you can design workflows that mirror real-world business logic — from simple approvals to complex event-driven automation.


💼 Professional Support Available

If you are facing issues in real projects related to enterprise backend development or workflow automation, I provide paid consulting, production debugging, project support, and focused trainings.

Technologies covered include Java, Spring Boot, PL/SQL, Azure, and workflow automation (jBPM, Camunda BPM, RHPAM).



Comments

Popular posts from this blog

jBPM Installation Guide: Step by Step Setup

Scopes of Signal in jBPM

OOPs Concepts in Java | English | Object Oriented Programming Explained