jBPM Workflow Tutorial: ⚙️ Complex Gateway

 🚀 Introduction

The ⚙️ Complex Gateway in jBPM is used for advanced synchronization and branching rules that cannot be modeled using other gateways.
It allows you to specify complex conditions, such as:

  • “Wait for any 2 out of 3 tasks before proceeding”

  • “Proceed when either Task A is done OR both Task B and Task C are complete”

  • “Loop until a specific condition is satisfied”

⚙️ Complex Gateways are less common, but very useful in sophisticated workflows.


🛠️ Prerequisites

  • 💻 jBPM/Business Central & KIE Server installed

  • ☕ JDK 11+ or JDK 17

  • 👨‍💼 Users assigned to required Human Tasks

  • 🌐 Access: http://localhost:8080/business-central


📝 Step 1: Create a New Process

  1. 🔑 Log in to Business Central

  2. 📂 Create a project: complex-gateway-demo

  3. ➕ Add Business Process: ComplexProcess

    • Id: com.example.complex

    • Package: com.example


🎨 Step 2: Design the Workflow

  1. 🔵 Add a Start node

  2. ➕ Add a Parallel Gateway (to split into multiple tasks)

  3. 👤 Add Task A, Task B, and Task C

  4. ⚙️ Add a Complex Gateway (Join)

  5. ✅ Add an End node

🔗 Flow:
Start → ➕ Split → (Task A, Task B, Task C) → ⚙️ Complex Join → End


📊 Step 3: Define Complex Synchronization Rule

  • Open the Complex Gateway properties

  • Example rule: Wait for any 2 of 3 tasks to complete before proceeding

In jBPM, this is modeled with Activation Condition + Completion Condition.

Example Pseudo Expression

activationCondition = "numberOfCompletedInstances >= 2" completionCondition = "numberOfActiveInstances == 0"

This means:

  • Gateway activates when 2 out of 3 tasks are done

  • Process moves forward when no more active instances remain (or when the condition is met).


⚙️ Step 4: Build and Deploy

  1. 💾 Save the process

  2. 🛠️ Build & Install

  3. 📦 Deploy to KIE Server


▶️ Step 5: Run the Process

  1. Go to Manage → Process Definitions

  2. ▶️ Start a new instance of ComplexProcess

  3. 👤 Complete any 2 of the 3 tasks (Task A, Task B, Task C)

  4. ⚙️ Complex Gateway will trigger → process moves to End


📌 Step 6: Example Use Cases

  • 👨‍👩‍👧 Group approvals: require at least 2 out of 3 managers to approve

  • 🏦 Banking: require 2 of 3 signatures for high-value transactions

  • 🏥 Healthcare: proceed when two medical checks are complete, even if a third is pending



👉 Watch jBPM Workflow Tutorial: ⚙️ Complex Gateway in Action better:

Here's a quick video to help you understand jBPM Workflow Tutorial: ⚙️ Complex Gateway in Action better: Coming soon YouTube: Learn IT with Shikha


🛠️ Troubleshooting

  • Process stuck at Complex Gateway? → Ensure activation/completion conditions are correctly defined

  • ⚠️ Moves too early? → Condition logic may be too loose

  • 🔄 Never moves forward? → Condition logic may be too strict (no path satisfied)


🎯 Conclusion

The ⚙️ Complex Gateway is a powerful but rarely used gateway in jBPM, perfect for advanced branching and synchronization rules.

It allows you to:

  • Wait for N out of M tasks

  • Combine multiple conditions before proceeding

  • Handle sophisticated approval scenarios

By mastering Complex Gateways, you can design enterprise-grade workflows that require flexible and intelligent decision-making beyond basic XOR, OR, and AND flows.


💼 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).

🎥 Learn IT with Shikha on YouTube

Prefer learning through videos? Watch practical tutorials on Kafka, Camunda, Alfresco, Java, Spring Boot, Microservices and Enterprise Architecture.

▶ Subscribe to Learn IT with Shikha on YouTube

Comments

Post a Comment

Popular posts from this blog

Top 50 Camunda BPM Interview Questions and Answers for Developers (2026 Guide)

10 BPMN Best Practices Every Camunda Developer Should Know

OOPs Concepts in Java | English | Object Oriented Programming Explained