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
managerrole -
🌐 Browser access: http://localhost:8080/business-central
📝 Step 1: Create a New Project
-
🔑 Log in to Business Central
-
📂 Create project: approval-gateway
-
➕ Add new Business Process: ApprovalProcess
-
Id:
com.example.approval -
Package:
com.example
-
🎨 Step 2: Design the Workflow
-
🔵 Add a Start node
-
👤 Add a Human Task → configure:
-
🏷️ Name: Review Request
-
👥 Actors: manager
-
📝 Task Name: review-request
-
-
🔀 Add an Exclusive Gateway (XOR) after Human Task
-
✅ Add an End node for Approved path
-
❌ Add another End node for Rejected path
-
🔗 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
-
Select the Gateway → add two outgoing connections:
-
✅ Approved Path → condition:
-
❌ Rejected Path → condition:
-
🔨 Step 5: Build and Deploy
-
💾 Save process
-
🛠️ Build & Install project
-
📦 Ensure deployment to KIE Server
▶️ Step 6: Run the Process
-
Go to Manage → Process Definitions
-
▶️ Start new instance of ApprovalProcess
-
👤 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
managerrole -
⚠️ Both paths trigger? → Ensure conditions on outgoing connections are mutually exclusive
-
🔄 Process not completing? → Verify at least one path has a condition set correctly
🎯 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).
📧 Contact: ishikhanirankari@gmail.com | info@realtechnologiesindia.com
🌐 Website: IT Trainings | Digital metal podium
Comments
Post a Comment