Event types supported by Flowable process event engine
Instructions on process definition listeners
- Event listeners can only be declared on the
process
element as a child element ofextensionElements
. (Event) listeners cannot be defined on individual nodes (activities). - Expressions in
delegateExpression
, unlike other expressions (such as those in gateways), do not have access to the execution context. You can only reference beans defined by thebeans
parameter in the process engine configuration; or when using spring (and no beans parameter is defined), reference any spring bean that implements the listener interface. - When using the listener’s
class
attribute, only one instance of the class will be created. Please ensure that the listener implementation does not rely on member variables or is safe for use with multiple threads/contexts. - If the
events
attribute uses an illegal event type or uses an illegalthrowEvent
value, an exception will be thrown when the process definition is deployed (causing the deployment to fail). Ifclass
ordelegateExecution
specifies an illegal value (non-existent class, non-existent bean reference, or proxy class does not implement the listener interface), when the process starts ( Or the first valid event defined by the process is dispatched to this listener), an exception will be thrown. Please ensure that the referenced class is on the classpath and that the expression resolves to a valid instance.
Distributing events via API
An event distribution mechanism can be provided through the API to distribute custom events to any listener registered in the engine. It is recommended (but not required) to only distribute FlowableEvents
of type CUSTOM
. Use RuntimeService
to distribute events:
/** * Distribute the given event to all registered listeners. * @param event The event to be distributed. * * @throws FlowableException when an exception occurs when dispatching events, or {@link FlowableEventDispatcher} is disabled. * @throws FlowableIllegalArgumentException when the given event is not dispatchable */ void dispatchEvent(FlowableEvent event);
Supported event types
The following table lists all event types in the engine. Each type corresponds to an enumeration value in org.flowable.engine.common.api.delegate.event.FlowableEventType
.
Event name | Description | Event class |
---|---|---|
ENGINE_CREATED | The process engine to which this listener belongs has been created and can respond to API calls. | org.flowable…FlowableEvent |
ENGINE_CLOSED | The process engine to which this listener belongs has been closed , no more API calls can be made to this engine. | org.flowable…FlowableEvent |
ENTITY_CREATED | A new entity has been created. This entity is included in this event. | org.flowable…FlowableEntityEvent |
ENTITY_INITIALIZED | The new entity has been created and fully initialized. If any child entities are created as part of this entity, this event will be fired after the child entities are created/initialized, as opposed to the ENTITY_CREATE event. |
org.flowable…FlowableEntityEvent |
ENTITY_UPDATED | The entity has been updated. This entity is included in this event. | org.flowable…FlowableEntityEvent |
ENTITY_DELETED | The entity has been deleted. This entity is included in this event. | org.flowable…FlowableEntityEvent |
ENTITY_SUSPENDED | The entity has been suspended. This entity is included in this event. This event is dispatched by ProcessDefinitions, ProcessInstances and Tasks. | org.flowable…FlowableEntityEvent |
ENTITY_ACTIVATED | The entity has been activated. This entity is included in this event. ProcessDefinitions, ProcessInstances and Tasks will dispatch this event. | org.flowable…FlowableEntityEvent |
JOB_EXECUTION_SUCCESS | The job has been successfully executed. This job is included in this event. | org.flowable…FlowableEntityEvent |
JOB_EXECUTION_FAILURE | Job execution failed. The job and exception are included in this event. | org.flowable…FlowableEntityEvent and org.flowable…FlowableExceptionEvent |
JOB_RETRIES_DECREMENTED | The number of job retries has been reduced due to execution failures. This job is included in this event. | org.flowable…FlowableEntityEvent |
TIMER_SCHEDULED | A scheduled job has been created and is expected to be Executed at a future time point. | org.flowable…FlowableEntityEvent |
TIMER_FIRED | The timer has triggered. | org.flowable…FlowableEntityEvent |
JOB_CANCELED | The job has been cancelled. This job is included in this event. Jobs are canceled due to API calls, associated boundary timers are canceled due to task completion, and they are also canceled due to the deployment of new process definitions. | org.flowable…FlowableEntityEvent |
ACTIVITY_STARTED | Node starts execution | org.flowable…FlowableActivityEvent |
ACTIVITY_COMPLETED | Node completed successfully | org. flowable...FlowableActivityEvent |
ACTIVITY_CANCELLED | The node will be canceled. There are three reasons for node cancellation (MessageEventSubscriptionEntity, SignalEventSubscriptionEntity, TimerEntity). | org.flowable...FlowableActivityCancelledEvent |
ACTIVITY_SIGNALED | The node received a signal | org.flowable…FlowableSignalEvent |
ACTIVITY_MESSAGE_RECEIVED | The node received a message. Events are dispatched before nodes receive messages. After a node receives the message, an ACTIVITY_SIGNAL or ACTIVITY_STARTED event is dispatched to the node, depending on its type (boundary event, or subprocess start event). |
org.flowable…FlowableMessageEvent |
ACTIVITY_MESSAGE_WAITING | A node has created a message event subscription , and is waiting to receive messages. | org.flowable…FlowableMessageEvent |
ACTIVITY_MESSAGE_CANCELLED | A node has canceled a message event subscription , so receiving this message will not trigger the node again. | org.flowable…FlowableMessageEvent |
ACTIVITY_ERROR_RECEIVED | The node received an error event. Distributed before the node actually handles the error. The activityId of this event is the node that handles the error. If the error is passed successfully, an ACTIVITY_SIGNALLED or ACTIVITY_COMPLETE message is subsequently sent to the node. |
org.flowable…FlowableErrorEvent |
UNCAUGHT_BPMN_ERROR | Thrown an uncaught BPMN error. The process does not have a handler for this error. The activityId of this event is empty. |
org.flowable…FlowableErrorEvent |
ACTIVITY_COMPENSATE | The node will be compensated. This event contains the ID of the node on which compensation will be performed. | org.flowable…FlowableActivityEvent |
MULTI_INSTANCE_ACTIVITY_STARTED | Multiple instance nodes start executing | org.flowable…FlowableMultiInstanceActivityEvent |
MULTI_INSTANCE_ACTIVITY_COMPLETED | Multi-instance node completed successfully | org.flowable…FlowableMultiInstanceActivityEvent |
MULTI_INSTANCE_ACTIVITY_CANCELLED | The multi-instance node will be canceled. There are three reasons for cancellation of multi-instance nodes (MessageEventSubscriptionEntity, SignalEventSubscriptionEntity, TimerEntity). | org.flowable...FlowableMultiInstanceActivityCancelledEvent |
VARIABLE_CREATED | The process variable has been created. This event includes the variable name, value, and associated execution and tasks (if any). | org.flowable…FlowableVariableEvent |
VARIABLE_UPDATED | The variable has been updated. This event includes the variable name, value, and associated execution and tasks (if any). | org.flowable…FlowableVariableEvent |
VARIABLE_DELETED | The variable has been deleted. This event contains the variable name, last value, and associated execution and task (if any). | org.flowable…FlowableVariableEvent |
TASK_ASSIGNED | The task has been assigned to the user. This task is included in this event. | org.flowable…FlowableEntityEvent |
TASK_CREATED | The task has been created. This event is dispatched after the ENTITY_CREATE event. If the task is part of a process, this event will be triggered before the task listener is executed. |
org.flowable…FlowableEntityEvent |
TASK_COMPLETED | The task has been completed. This event is dispatched before the ENTITY_DELETE event. If the task is part of a process, this event will be triggered before the process advances and will be followed by an ACTIVITY_COMPLETE event pointing to the node representing the task. |
org.flowable…FlowableEntityEvent |
PROCESS_CREATED | The process instance has been created. All basic parameters have been set, but the variables have not been set yet. | org.flowable…FlowableEntityEvent |
PROCESS_STARTED | The process instance has been started. Distributed when starting a previously created process. The PROCESS_STARTED event is dispatched after the related ENTITY_INITIALIZED event and the variable is set. | org.flowable…FlowableEntityEvent |
PROCESS_COMPLETED | The process instance has been completed. Dispatched after the last node’s ACTIVITY_COMPLETED event. A process ends when the process instance has no path to continue. |
org.flowable…FlowableEntityEvent |
PROCESS_COMPLETED_WITH_TERMINATE_END_EVENT | The process has reached the termination end event (terminate end event) and ends. | org.flowable…FlowableProcessTerminatedEvent |
PROCESS_CANCELLED | The process has been canceled. Dispatched before the process instance is removed from the runtime. The process instance is canceled by the API call RuntimeService.deleteProcessInstance . |
org.flowable…FlowableCancelledEvent |
MEMBERSHIP_CREATED | The user has joined the group. This event contains the relevant user and group IDs. | org.flowable…FlowableMembershipEvent |
MEMBERSHIP_DELETED | The user has been removed from the group. This event contains the relevant user and group IDs. | org.flowable…FlowableMembershipEvent |
MEMBERSHIPS_DELETED | All users in the group will be removed. This event is thrown before the user moves out, so the relationship is still accessible. For performance reasons, the MEMBERSHIP_DELETED event will no longer be thrown for each removed user. |
org.flowable…FlowableMembershipEvent |
All ENTITY_\*
events in the engine are associated with entities. The following table lists the entity events distributed by each entity:
- ENTITY_CREATED, ENTITY_INITIALIZED, ENTITY_DELETED: Attachment, Comment, Deployment, Execution, Group, IdentityLink, Job, Model (Model), process definition (ProcessDefinition), process instance (ProcessInstance), task (Task), user (User).
- ENTITY_UPDATED: attachment, deployment, execution, group, identity association, job, model, process definition, process instance, task, user.
- ENTITY_SUSPENDED, ENTITY_ACTIVATED: Process definition, process instance/execution, task.
Additional information
**Listeners will only respond to events distributed by the engine in which they are located. **So if you run different engines on the same database, only events generated by the engine registered by the listener will be distributed to the listener. Events generated by other engines will not be distributed to this listener, regardless of whether these engines are running under the same JVM.
Certain event types (entity-related) expose target entities. Depending on the event type, some entities cannot be updated (such as entities in entity delete events). If possible, use event-exposed EngineServices
to operate the engine safely. Even so, care needs to be taken when updating and operating entities exposed in events.
History does not dispatch entity events because they all have corresponding runtime entity dispatch events.