Skip to content

Intermediate Events

Overview

An intermediate event is a type of event in BPMN (Business Process Model and Notation) that occurs during the execution of a process. Intermediate events can affect the flow of the process or cause the process to wait for a specific condition to be met. There are various types of intermediate events, including message capture events, timer capture events, and signal capture events.

Message Capture Event

Description

A message capture event is an intermediate event that waits for a message to be received. When the message is received, the process continues execution. Message capture events are typically used to implement asynchronous communication between different parts of a process or between different processes.

Configuration

  1. Event Name: Set the name of the event for easy identification.
  2. Message Definition: Select a pre-defined message definition from the dropdown list.
  3. Variable Mapping: Map the message content to process variables for use in subsequent activities.
  4. Timeout Setting: Configure a timeout period for the message capture event. If no message is received within the specified time, the process can take alternative actions.

Example

javascript
// Example: Triggering a message capture event
const messageName = 'orderApproved';
const messageData = {
  orderId: 'ORD-12345',
  approvedBy: 'John Doe',
  approvalDate: new Date().toISOString()
};

bpmn.sendMessage(messageName, messageData);

Timer Capture Event

Description

A timer capture event is an intermediate event that waits for a specific time or time interval to elapse. When the timer expires, the process continues execution. Timer capture events are typically used to implement delays, timeouts, or scheduled activities in a process.

Configuration

  1. Event Name: Set the name of the event for easy identification.
  2. Timer Type: Select the type of timer:
    • Date: Trigger at a specific date and time (e.g., 2023-12-31T23:59:59).
    • Duration: Trigger after a specified duration (e.g., PT1H30M for 1 hour and 30 minutes).
    • Cycle: Trigger repeatedly at specified intervals (e.g., R/PT24H for every 24 hours).
  3. Timer Expression: Enter a timer expression based on the selected timer type, following the ISO 8601 format.
  4. Description: Provide a brief description of the timer event for documentation purposes.

Example

Timer TypeTimer ExpressionDescription
Date2023-12-31T23:59:59Trigger at 23:59:59 on December 31, 2023
DurationPT1H30MTrigger after 1 hour and 30 minutes
CycleR/PT24HTrigger every 24 hours

Signal Capture Event

Description

A signal capture event is an intermediate event that waits for a signal to be broadcast. When the signal is received, the process continues execution. Unlike message events, signals are broadcast to all interested receivers, making them suitable for implementing publish-subscribe patterns in a process.

Configuration

  1. Event Name: Set the name of the event for easy identification.
  2. Signal Definition: Select a pre-defined signal definition from the dropdown list.
  3. Variable Mapping: Map the signal content to process variables for use in subsequent activities.
  4. Multiple Instances: Configure whether the event should handle multiple instances of the same signal.

Example

javascript
// Example: Broadcasting a signal
const signalName = 'inventoryLow';
const signalData = {
  productId: 'PROD-98765',
  currentStock: 10,
  reorderLevel: 50
};

bpmn.broadcastSignal(signalName, signalData);

Implementation Details

Message Definition

PropertyDescriptionExample Value
Message NameUnique identifier for the messageorderApproved
Message VariableVariable that will store the message contentorderMessage
Data TypeType of data contained in the messageJSON
DescriptionBrief description of the messageOrder approval notification

Timer Definition

PropertyDescriptionExample Value
Timer NameUnique identifier for the timerpaymentTimeout
Timer TypeType of timer (Date, Duration, Cycle)Duration
Timer ExpressionExpression defining when the timer triggersPT30M
DescriptionBrief description of the timerPayment timeout after 30 minutes

Signal Definition

PropertyDescriptionExample Value
Signal NameUnique identifier for the signalinventoryLow
Signal VariableVariable that will store the signal contentinventorySignal
Data TypeType of data contained in the signalJSON
DescriptionBrief description of the signalLow inventory notification

Usage Scenarios

Message Capture Event

  • Order Processing: Wait for payment confirmation message before shipping an order.
  • Approval Workflow: Wait for manager approval message before proceeding with a request.
  • Integration with External Systems: Wait for a response message from an external API call.

Timer Capture Event

  • Payment Reminders: Send a reminder email 3 days before a payment is due.
  • Timeout Handling: Cancel an order if payment is not received within 30 minutes.
  • Scheduled Maintenance: Perform system maintenance every Saturday at 2:00 AM.

Signal Capture Event

  • Inventory Management: Trigger a reorder process when inventory levels are low.
  • System Alerts: Notify all active processes when a critical system failure occurs.
  • Batch Processing: Start a batch processing job when a signal is received indicating that a batch of files is ready.

Best Practices

  1. Use Descriptive Names: Give intermediate events meaningful names to improve process readability and maintainability.
  2. Define Clear Boundaries: Ensure that intermediate events have well-defined start and end conditions to avoid ambiguous process behavior.
  3. Handle Exceptions: Configure appropriate timeout and error handling mechanisms for intermediate events to prevent processes from getting stuck.
  4. Document Thoroughly: Provide detailed descriptions for intermediate events, including their purpose, configuration, and expected behavior.
  5. Test Rigorously: Test intermediate events with various scenarios, including normal operation, timeouts, and error conditions, to ensure they work as expected.

Summary

Intermediate events are a powerful feature in BPMN that enable processes to respond to external events, wait for specific conditions, or introduce delays. By understanding and properly configuring message capture events, timer capture events, and signal capture events, you can design more flexible and robust business processes.