Execution Engine
Introduction
The BPM execution engine comprises a set of Camunda listeners and JavaDelegate implementations that handle the runtime lifecycle of BPMN processes. These components manage node activation and deactivation, message correlation between processes, user task management, Axelor action execution, and email notifications.
WkfExecutionListener
The WkfExecutionListener implements the Camunda ExecutionListener interface and is attached to all BPMN flow elements. It is the central component that reacts to process execution events.
Event Handling
The listener responds to two event types:
Start Event (EVENTNAME_START)
When a node starts execution:
-
If the
activityInstanceIdis null (meaning the process itself just started), a newWkfInstancerecord is created in the database with:-
The Camunda process instance ID
-
A reference to the
WkfProcess -
The process key stored as a process variable
-
-
If the
activityInstanceIdis not null (a regular node activation),processNodeStart()is called to handle the node activation logic.
Node Start Processing
When a node starts (processNodeStart()):
-
The instance’s current node is updated (
WkfInstance.nodefield) -
A log appender is attached for non-blocking nodes
-
For intermediate throw events: a message is sent to correlate with other processes (see Message Correlation)
-
For blocking nodes (userTask, catchEvent, callActivity, endEvent):
-
A log entry is written
-
For end events: a message is also sent
-
The
onNodeActivation()callback is triggered, which:-
Sends an email notification if configured with
emailEvent = "start" -
Creates a TeamTask (user action) if
createTaskis enabled on the task configuration
-
-
Node End Processing
When a node ends (processNodeEnd()):
-
For business rule tasks: checks if the DMN result is compulsory. If no result was produced and the task is marked as compulsory, an error is thrown.
-
For blocking nodes: the
onNodeDeactivation()callback is triggered, which sends an email notification if configured withemailEvent = "end". -
For end events: all instance variables are removed from the Camunda runtime.
Blocking Nodes
The following BPMN element types are considered "blocking" — they pause process execution and wait for an external trigger:
-
userTask— Waits for user interaction -
catchEvent— Waits for a message, signal, or timer -
callActivity— Waits for a sub-process to complete -
endEvent— Terminal node of a process
Message Correlation
When a throw event or end event occurs, the listener reads the MessageEventDefinition from the BPMN element and evaluates any EL expressions in the message name. A MessageCorrelationBuilder is then used to:
-
Set the process key as a variable
-
Handle multi-tenancy with the appropriate tenant ID
-
Correlate the message with all matching receivers
-
Store resulting process instance IDs as process variables
This mechanism enables communication between different BPMN processes — one process can send a message that triggers a catch event in another process.
WkfActionService
The WkfActionService implements the JavaDelegate interface, allowing Axelor framework actions to be executed during BPMN task execution.
Execution Flow
When a service task with configured actions is reached:
-
The service finds the
WkfProcessby the current process definition ID -
It retrieves the start model from the process configuration (MetaModel or MetaJsonModel)
-
The model context (
FullContext) is obtained from the execution variables -
The "actions" attribute is read from the BPMN element (comma-separated action names)
-
Each action is executed:
-
ActionGroupentries are flattened into individual actions -
Each action is applied via
ActionService.applyActions(actionName, fullContext)
-
| This is how the "Actions" property configured in the BPM modeler properties panel gets executed at runtime. The actions are stored as a BPMN extension attribute on the element. |
SendTaskExecution
The SendTaskExecution class implements JavaDelegate for BPMN send tasks. When a send task is executed:
-
The
messageNameattribute is read from the BPMN element (Camunda extension namespace) -
EL expressions in the message name are evaluated using the
ExpressionManager -
The message is correlated to all matching receivers via
RuntimeService.createMessageCorrelation(msg).correlateAll()
This enables BPMN send tasks to trigger message catch events in other processes.
WkfTaskListener
The WkfTaskListener implements the Camunda TaskListener interface and handles user task lifecycle events.
Task Deletion Handling
When a user task is deleted (cancelled):
-
The listener finds the
WkfTaskConfigby the task definition key and process definition ID -
It looks up the associated
TeamTaskby the related process instance name and task email title, filtering for tasks with "new" status -
The TeamTask status is set to "canceled"
-
The task duration is calculated in seconds from the creation time to the current time
Email Notifications
The WkfEmailService handles email notifications triggered during node lifecycle events:
-
sendEmail(WkfTaskConfig, DelegateExecution)— Sends an email notification based on the task configuration’stemplateName,notificationEmail, andemailEventsettings -
createUrl(FullContext, String formName)— Creates a URL link to the model’s form view, included in the email body
Email notifications are triggered based on the emailEvent configuration:
| Email Event | When Triggered |
|---|---|
|
When the node is activated (process reaches this activity) |
|
When the node is deactivated (activity is completed) |
User Actions (TeamTask)
The WkfUserActionService manages TeamTask records that represent user actions in the BPM context:
-
createUserAction()— Creates a TeamTask entry when a node activates andcreateTaskis enabled on the task configuration -
processTitle()— Processes the task title template with context variables -
updateUserAction()— Updates the TeamTask when the associated Camunda task is completed -
migrateUserAction()— Migrates TeamTask records during process instance migration -
getUser()— Resolves the assigned user from a model field path
Technical Details
Backend Services
| Service | Responsibility |
|---|---|
|
Main execution listener on all BPMN flow elements — handles node start/end events |
|
Task listener — handles user task deletion and TeamTask cancellation |
|
JavaDelegate — executes Axelor actions configured on BPMN elements |
|
JavaDelegate — handles send task message correlation |
|
Email notification service for node lifecycle events |
|
TeamTask (user action) creation, update, and migration |
|
Central instance operations: evaluation, start, activation/deactivation, restart, cancel |
Related Pages
-
Deployment Pipeline — How BPM models are deployed to the Camunda engine
-
Auto-Evaluation — How workflows are automatically evaluated on model save
-
Task Evaluation — How task conditions are evaluated and tasks completed
-
App BPM Configuration — BPM engine settings
-
BPM Overview — Complete BPM feature overview