jBPM Workflow Tutorial: ⏳ Event-Based Gateway
🚀 Introduction
The ⏳ Event-Based Gateway in jBPM is used when the process must wait for external events before continuing.
Unlike ❌ Exclusive or 🟢 Inclusive Gateways, which rely on data conditions, the Event-Based Gateway listens for events such as:
-
📩 Message Events
-
⏰ Timer Events
-
🔔 Signal Events
It then follows the path of the event that occurs first.
🛠️ Prerequisites
-
💻 jBPM/Business Central & KIE Server installed
-
☕ JDK 11+ (or JDK 17)
-
🌐 Access:
http://localhost:8080/business-central -
🔔 Basic understanding of events in BPMN2 (Message, Timer, Signal)
📝 Step 1: Create a New Process
-
🔑 Log in to Business Central
-
📂 Create a project: event-gateway-demo
-
➕ Add Business Process: EventGatewayProcess
-
Id:
com.example.eventgateway -
Package:
com.example
-
🎨 Step 2: Design the Workflow
-
🔵 Add a Start node
-
⏳ Add an Event-Based Gateway
-
📩 Add an Intermediate Message Catch Event (Wait for customer response)
-
⏰ Add an Intermediate Timer Event (Timeout after X minutes/days)
-
Connect each event to its own End node
🔗 Flow:
Start → ⏳ Event-Based Gateway → (📩 Message Event → ✅ End, ⏰ Timer Event → ❌ End)
📊 Step 3: Define Behavior
-
⏳ The process pauses at the gateway and waits
-
📩 If a message arrives (e.g., "Customer Reply") → process continues down message path
-
⏰ If timer expires first → process continues down timer path
-
⛔ Only one event path is taken → the one that occurs first
⚙️ Step 4: Configure Events
-
📩 Message Event:
-
Name:
customerReply -
Message Ref:
CustomerResponse
-
-
⏰ Timer Event:
-
Duration:
PT5M(5 minutes) orP1D(1 day)
-
🔨 Step 5: Build and Deploy
-
💾 Save the process
-
🛠️ Build & Install
-
📦 Deploy to KIE Server
▶️ Step 6: Run the Process
-
Go to Manage → Process Definitions
-
▶️ Start a new instance of EventGatewayProcess
-
Process will wait at the gateway:
-
If 📩 customer reply arrives → process ends successfully
-
If ⏰ timeout → process ends via timer path
-
📌 Step 7: Example Use Cases
-
📩 Wait for user confirmation (message) OR ⏰ auto-cancel after timeout
-
📧 Email response expected OR fallback if ⏰ no reply in X days
-
🛒 Customer payment (message) OR ⏰ cancel order if not received in time
👉 Watch jBPM Workflow Tutorial: ⏳ Event-Based Gateway in Action better:
🛠️ Troubleshooting
-
❌ Process stuck? → Ensure event definitions are properly configured
-
⚠️ Both paths triggering? → Only one should fire; check if you used Intermediate Events, not normal tasks
-
🔄 Timer not working? → Use correct ISO 8601 duration (e.g.,
PT30S,PT5M,P1D)
🎯 Conclusion
The ⏳ Event-Based Gateway is essential for workflows that depend on external triggers rather than conditions.
It makes your processes responsive and time-aware:
-
📩 Wait for user/customer/system messages
-
⏰ Handle timeouts automatically
-
🔔 React to business signals
By using Event-Based Gateways, you can build dynamic workflows that adapt to real-world uncertainties, like waiting for responses, handling deadlines, or reacting to signals.
💼 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