No executionListener triggered on workflow execution

Hello there,
I’m starting with Camunda 7.14.0 migrating from Activiti 6.0.0 and I’m running into some difficulties to migrate our engine-wide event listeners to something that works in Camunda in a similar fashion.
Our application is a standalone spring based one and my initial idea was to add the ProcessEngine to the context using a SpringProcessEngineConfiguration as configuration. This seems to work and my preliminary tests are running.

But I find no way to set global listeners like in Activiti. I’ve read that I could subclass ProcessApplication and implement for instance the getExecutionListener method. I tried the following:

  • Implement a simple MyProcessApplication extending SpringProcessApplication overriding getExecutionListener
    private static class MyProcessApplication extends SpringProcessApplication {
        public ExecutionListener getExecutionListener() {
            return new ExecutionListener() {
                public void notify(DelegateExecution execution) throws Exception {
          "Got execution {}", execution);
                    //TODO: Check on the execution information
  • Define the ProcessEngine as a spring bean and therefore use the ManagedProcessEngineFactoryBean as the factory for the processEngine (since it seems to be the way to have control from the context of the ProcessEngine creation)
        public SpringProcessEngineConfiguration processEngineConfiguration() {
            SpringProcessEngineConfiguration processEngineConfiguration = new SpringProcessEngineConfiguration();
            processEngineConfiguration.setExpressionManager(new SpringExpressionManager(context, null));

            return processEngineConfiguration;

        public ManagedProcessEngineFactoryBean engineFactory(SpringProcessEngineConfiguration engineConfiguration) {
            ManagedProcessEngineFactoryBean factoryBean = new ManagedProcessEngineFactoryBean();
            return factoryBean;
  • Add an empty processes.xml in the META-INF directory

I created a simple workflow with start node, service task node and end node and even though it runs on my test case, my code returned by getExecutionListener never gets called.

My questions are:

  • What am I doing wrong so that the execution listener is not invoked upon workflow execution?
  • Is there any other recommended way to achieve the same result without using a ProcessApplication? I would prefer to do the bootstrap of the workflows as part of the spring context initialization so that everything is in the same place so my initial aim would be to intercept on the ProcessEngine itself if that is ever possible.
  • My main aim here is to listen on completion and cancelled process instance events, but I don’t want to add the listeners to every BPM process definition.

I’m attaching the test code I’m currently using.

Manuel (6.8 KB)

1 Like

Hello again,

just a shorter and easier to answer (I hope) related question:
Is there support in Camunda BPM to set a global listener and react to events like workflow cancellation and/or finalization?

Thanks and best regards

You can create a global execution listener than be triggered if the process ends.
You just need to select the model canvas and click on listeners tab in the properties panel and you can have something trigger before a process starts or before the process ends.

Hello Niall.
Thanks for your answer. But when I say global I mean something that affects all process instances for all process definitions I have deployed. I understand you are talking about setting the listener individually for each process definition,right?


Well one thing you could do is build an engine plugin that is a composite class of the history event handler

You could then intercept any events from the engine and run custom code based on the event. You can read more about that in the docs.

1 Like

Thanks a lot for the suggestion Niall, but I’m afraid the events are not specific enough for my needs.
The approach works and I’m getting events from the engine, problem is that for a workflow cancelation, I get just something like this:

09:16:28.361 [main] INFO c.i.t.g.c.CamundaEngineTest - Got event of type class org.camunda.bpm.engine.impl.history.event.HistoricTaskInstanceEventEntity with content HistoricTaskInstanceEventEntity[taskId7, assignee=null, owner=null, name=The Nice User Task, description=null, dueDate=null, followUpDate=null, priority=50, parentTaskId=null, deleteReason=Testing, taskDefinitionKey=userTask, durationInMillis=null, startTime=Fri Dec 04 09:16:28 CET 2020, endTime=Fri Dec 04 09:16:28 CET 2020, id=7, eventType=complete, executionId=4, processDefinitionId=UserTask:1:3, rootProcessInstanceId=4, processInstanceId=4, activityInstanceId=userTask:6, tenantId=null]

This is a cancellation happening as result of calling
RuntimeService.deleteProcessInstance for a process instance where the execution reached an user task. My problem is: How can I tell whether a cancellation is taking place? I’m afraid the event is not specific enough, is it? Or am I missing something?