Global event listner not running

Hello,
we are trying to get the global event listener running.

We tried to use this tutorial: Process Application Event Listeners | docs.camunda.org

The problem is that the method “getTaskListener” and “getExecutionListener” is never called.
But the Class is loaded because of the logging in the constructor.

As an example event, we start a new Process with

POST http://localhost:8080/engine-rest/process-definition/key/myOwnProvess/start.

For deployment create a new .war from the Code and copy it to server\apache-tomcat-9.0.43\webapps\

Does anybody know what we are doing wrong?

We use:

  • Camunda Open Source Edition: 7.15.0
  • Tomcat 9.0.43

Here is the Code:

package de.iisys.sysint.hicumes.camunda.extension;

import org.camunda.bpm.application.ProcessApplication;
import org.camunda.bpm.application.impl.ServletProcessApplication;
import org.camunda.bpm.engine.delegate.DelegateExecution;

import org.camunda.bpm.engine.delegate.DelegateTask;
import org.camunda.bpm.engine.delegate.ExecutionListener;
import org.camunda.bpm.engine.delegate.TaskListener;

@ProcessApplication("CamundaCommunicationApplication")
public class CamundaCommunicationApplication extends ServletProcessApplication {

    public CamundaCommunicationApplication() {
        System.out.println("starting CamundaCommunicationApplication");
    }


    public TaskListener getTaskListener() {
        System.out.println("getTaskListener");
        return new TaskListener() {
            @Override
            public void notify(DelegateTask delegateTask) {
                System.out.println("TaskListener Event");
            }
        };
    }

    public ExecutionListener getExecutionListener() {
        System.out.println("getExecutionListener");
        return new ExecutionListener() {
            @Override
            public void notify(DelegateExecution execution) throws Exception {
                System.out.println("ExecutionListener Event");
            }
        };
    }
}

Thank you for your help.

Are you using pre-packaged Camunda Platform distributions?

To use the global process application Event Listeners, you need to activate the corresponding Process Engine Plugin:

<process-engine name="default">
  ...
  <plugins>
    <plugin>
      <class>org.camunda.bpm.application.impl.event.ProcessApplicationEventListenerPlugin</class>
    </plugin>
  </plugins>
</process-engine>

Note that this plugin is activated by default in the pre-packaged Camunda Platform distributions.

Thank you for your response.
We used the download from here: Camunda herunterladen - Camunda (Tomcat Zip). Additionally, we checked that the plugin is activated.

We tested some different ways of deploying the bpmn file.
During the test, the recognized the following:

  1. If the .bpmn is inside the .war with the
@ProcessApplication("CamundaCommunicationApplication")
public class CamundaCommunicationApplication extends ServletProcessApplication {

class, we get the events.
2) If the .bpmn file is in an additonally war, it is deployed, but we do not get events.
3) If we upload the .bpmn file over the rest API, we do not get events.

We think we have a configuration problem within the camunda engine.

Does anybody have a hint, what we have to change to get it running?

I guess this is the expected behavior.
The docs state that “When using the process application API, the process engine makes sure that Events are delegated to the right process application.”

However, I would like to have a global event listener in a shared engine environment (Tomcat), too, that is bundled in a .war whereas there are processes each bundled in its own .war.
So, what would be a good way to achieve that?

Hi @philipp.hehnle,

global events are handled in the process engine itself, not in the process applications.

Packaging in a war would not work due to classloader restrictions. But you can package them as jar and put the jar in the lib folder next to the camunda-engine.jar.

Here are some examples: camunda-bpm-examples/process-engine-plugin at master · camunda/camunda-bpm-examples · GitHub.

Hope this helps, Ingo

1 Like