Can I listen to a process instance removal?

Camunda gives us an opportunity to delete a process instance. It could be done either REST API or through the cockpit. We also can delete an instance using Camunda Java API.

So I would like to have a java listener which is executed on a process instance delete event.

I didn’t manage to find a neat solution for that.

Any suggestion?

You can create a end listener of process instance which will be called on process deletion as well.
More info for execution listeners:
https://docs.camunda.org/manual/latest/user-guide/process-engine/delegation-code/#execution-listener

Hi!
I’ve tried this approach, but it wasn’t called.

<bpmn:process id="myProcessId" isExecutable="true">
   <bpmn:extensionElements>
     <camunda:executionListener class="com.company.diagram.listener.EndListener" event="end" />
   </bpmn:extensionElements>
   <bpmn:startEvent id="theStart">
...
</bpmn:process>

Hi @Vyacheslav_Biletskiy,

it looks correct. What did you do exactly?

You can find a working example in the tests: https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/bpmn/executionlistener/ExecutionListenerTest.java#L518-L541.

Hope this helps, Ingo

Thanks! I tried to remove a process via UI. Today I used REST API endpoint to remove a process and listener was invoked.
Also I found out if we remove process bu REST we have skipCustomListener=false.
And if I remove a process using UI I can see this property as a true.
I think this is the problem.
Do you know the way how to set mentioned property to false globally?

Which is your Camunda version and from where do you trigger the deletion in the UI?

I use camunda 7.9v.
Screenshot%20from%202019-07-08%2017-23-23

Only now I noticed a modal window with skipCustomListener checkbox:
image

So can we uncheck and disable it by default?

Please have a look at this page for 7.9:
https://docs.camunda.org/manual/7.9/webapps/cockpit/extend/configuration/#skipcustomlisteners-flag

7.11:
https://docs.camunda.org/manual/7.11/webapps/cockpit/extend/configuration/#skipcustomlisteners-and-skipiomappings-flags

Thanks @Yana!
And do you know how I can configure that with Camunda Spring Boot application?

This might help you:

Thanks for the quick response. I’ll try it and post here my results.

Thank you @Yana. This helped me to set skipCustomListerer to false and hide it.
In my case, I added a config.js file in app/cockpit/scripts/ folder - src/main/resources/META-INF/resources/app/tasklist/scripts/config.js
And now this modal window looks like
image

Hi,

I am also in same situation. Could you please let me know your java code for listening end event? Thanks.

Regards,
Ranjit

Hi @Ranjit_V,

may I ask for your use case? What should happen if a process is deleted?

Regards Tobias

Hi @Tobias_Conz ,

Thanks for your response. When user delete the process from cockpit, another service task should trigger. Asked here, When user delete Process Instance from cockpit, it should trigger a service task - #5 by jwulf .

Regards,
Ranjit