Execution listeners vs. event listeners

Hi,
flowable offers several concepts to hook in custom coding on certain events. On the hand, you can configure execution listeners in the bpmn2 model for specific activities. On the other hand, you can contribute event listeners that listen to certain event types.

Is there any documentation available on the pros and cons of the respective concepts? I´m particular interested in the aspects like performance and transactionality.

Best regards,
Stefan

Hi Stefan,

Docs:
execution listeners: http://www.flowable.org/docs/userguide/index.html#executionListeners
Event dispatcher: http://www.flowable.org/docs/userguide/index.html#eventDispatcher

Execution listener supports events on the process instance level. Event dispatcher dispatches engine “low” level events.

Performance:Event dispatcher is able to dispatch various low level events, which can affect performance. From my point of view, event handlers affect performance more than event dispatcher.
Transactionality
http://www.flowable.org/docs/userguide/index.html#_sidetrack_transactionality

Regards
Martin

@martin.grofcik is indeed correct, the even dispatcher is on a lower leven than the execution listeners. The execution listeners are called at a configured point in the flow (typically to do something technically, that shouldn’t be visible in the diagram), while the event dispatcher works on lower level events (like entity creation) independent of the flow.

Wrt transactionality: both are transactional (unless you’re calling out to a non-transactional system). If an exception happens in either, a rollback will happen.

@joram sorry for the gravedigging but while event listeners happen on a lower level, you cannot manage to do anything you do with execution ones.

Not all event listeners implement FlowableEntityWithVariablesEvent interface, in fact PROCESS_COMPLETED event type doesn’t, and that is why if you want to get the variable values at the end of a process your only way is to use an ExecutionListener.