Execution listener being run by process engine with jobExecutorActivate=false

Hi, I’m attempting to setup an execution listener that will notify if a workflow is cancelled in the cockpit.

The setup is as follows:

  • An embedded process engine in an api to which the workflow is deployed.
  • An instance of the cockpit running with its own process engine pointing to the same database. However <property name="jobExecutorActivate">false</property>

If defined a custom execution listener in the api:
package com.test

import org.camunda.bpm.engine.delegate.{DelegateExecution, ExecutionListener}

class WorkflowCancellationExecutionListener(slackNotifier: SlackNotifier) extends ExecutionListener {
override def notify(execution: DelegateExecution): Unit = {
if (execution.isCanceled) do something

This is linked to the workflow in the process level:
<bpmn:process id=“ExecutionListenerTest” name=“ExecutionListenerTest” isExecutable=“true”>
<camunda:executionListener class=“com.allangray.workflow.core.workflow.WorkflowCancellationExecutionListener” event=“end” />

Once an process instance is started and stopped at the message intermediate catch event, I attempt to cancel the workflow in the Cockpit and deselecting the Skip Custom Listeners checkbox.

This exception is raised in the Cockpit process engine log:

    at org.camunda.bpm.engine.rest.sub.runtime.impl.ProcessInstanceResourceImpl.deleteProcessInstance(ProcessInstanceResourceImpl.java:66)
    ... 55 more

Caused by: org.camunda.bpm.engine.ClassLoadingException: ENGINE-09017 Cannot load class ‘com.test.WorkflowCancellationExecutionListener’: com.test.WorkflowCancellationExecutionListener
at org.camunda.bpm.engine.impl.util.EngineUtilLogger.classLoadingException(EngineUtilLogger.java:135)
at org.camunda.bpm.engine.impl.util.ReflectUtil.loadClass(ReflectUtil.java:107)
at org.camunda.bpm.engine.impl.util.ClassDelegateUtil.instantiateDelegate(ClassDelegateUtil.java:42)

Since the custom execution listener is not on the Cockpit instance this makes sense, but I don’t understand why the Cockpit’s engine is doing the execution.

Hi @Andrew_Henderson,

unfortunately you cannot split the listerner execution from the bpmn activity with the help of asychnonous continuation and job executor.

Have a look at the docs here for further details: https://docs.camunda.org/manual/7.11/user-guide/process-engine/transactions-in-processes/#understand-asynchronous-continuations

Hope this helps, Ingo

Hi @Ingo_Richtsmeier, not sure I understand. My execution listener is not on the activity its on the process instance level.

What I thought would happen when clicking the Delete running process instance button in the cockpit is that a job would be created to handle the deletion of the process instance. That doesn’t happen in this instance.

What I have discovered is if I use the batch process in the cockpit to delete the process instance then a job is created with HANDLER_TYPE_ = instance-deletion and my api’s process engine is picking up the job and since it has the execution listener I can notify on process cancellation.

I dont understand why the two cancellation methods are handled differently, but my requirement works on batch cancellation/deletion so we will have to cancel that way to be able to notify.

Hi @Andrew_Henderson,

deleting an single process instance calls the listener synchronously. That was the default implementation and (mostly) suffcient for a single command running in a homogeneous cluster.

The Batch deletion was added later to handle larger amount of process instances. The asynchronous delete is used for non blocking user interface.

Hope this helps, Ingo