jBPM Workflow Tutorial: 🔀 Gateway Example (Approve/Reject Flow)

🚀 Introduction

In this tutorial, you’ll learn how to use a 🔀 Gateway in jBPM to make your process follow different paths based on conditions.
We’ll build a simple approval workflow:

🔵 Start → 👤 Human Task → 🔀 Gateway → ✅ Approved Path / ❌ Rejected Path → 🔴 End


🛠️ Prerequisites

  • 💻 jBPM/Business Central & KIE Server bundle (7.x or 8.x community)

  • ☕ JDK 11+ (JDK 17 also works)

  • 👨‍💼 User with manager role

  • 🌐 Browser access: http://localhost:8080/business-central


📝 Step 1: Create a New Project

  1. 🔑 Log in to Business Central

  2. 📂 Create project: approval-gateway

  3. ➕ Add new Business Process: ApprovalProcess

    • Id: com.example.approval

    • Package: com.example


🎨 Step 2: Design the Workflow

  1. 🔵 Add a Start node

  2. 👤 Add a Human Task → configure:

    • 🏷️ Name: Review Request

    • 👥 Actors: manager

    • 📝 Task Name: review-request

  3. 🔀 Add an Exclusive Gateway (XOR) after Human Task

  4. ✅ Add an End node for Approved path

  5. ❌ Add another End node for Rejected path

  6. 🔗 Connect: Start → Human Task → Gateway → End(Approved/Rejected)


📊 Step 3: Define Data

  • Add process variable:

    • Name: approved

    • Type: Boolean

  • In Human Task form, let the user set approved = true/false


⚙️ Step 4: Configure Gateway Conditions

  1. Select the Gateway → add two outgoing connections:

    • Approved Path → condition:

      approved == true
    • Rejected Path → condition:

      approved == false

🔨 Step 5: Build and Deploy

  • 💾 Save process

  • 🛠️ Build & Install project

  • 📦 Ensure deployment to KIE Server


▶️ Step 6: Run the Process

  1. Go to Manage → Process Definitions

  2. ▶️ Start new instance of ApprovalProcess

  3. 👤 Human Task is assigned → open the form → select approve or reject


📌 Step 7: Outcome Paths

  • ✅ If approved = true → flow goes to Approved End node

  • ❌ If approved = false → flow goes to Rejected End node


🛠️ Troubleshooting

  • Task not visible? → Check user is in manager role

  • ⚠️ Both paths trigger? → Ensure conditions on outgoing connections are mutually exclusive

  • 🔄 Process not completing? → Verify at least one path has a condition set correctly


👉Watch jBPM Gateway Example (Approve/Reject Flow) Practical in Action better: Here's a quick video to help you understand jBPM Gateway Example (Approve/Reject Flow) in Practical in Action better: jBPM Gateways Tutorial in Hindi | Exclusive, Inclusive & Parallel Explained


🎯 Conclusion

The 🔀 Gateway workflow shows how business decisions drive process flow in jBPM. By branching paths based on conditions (like approval/rejection), you make workflows smarter and closer to real-world scenarios.

This simple Approve/Reject example demonstrates:

  • 👤 Using Human Tasks to collect decisions

  • 🔀 Using Exclusive Gateways to branch process flow

  • ✅ / ❌ Different outcomes based on variables

Next, you can explore:

  • 🔀 Parallel Gateways for running tasks simultaneously

  • 🌀 Inclusive Gateways for multiple valid paths

  • 🔗 Combining Gateways with Service or Script Tasks for complex business rules

💼 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

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