# RuntimeService::deleteProcessInstance does not trigger the specified listeners

**URL:** <https://forum.flowable.org/t/runtimeservice-deleteprocessinstance-does-not-trigger-the-specified-listeners/2881>\
**Category:** Flowable Engine\
**Created:** [November 9, 2018, 2:01pm UTC](https://forum.flowable.org/t/runtimeservice-deleteprocessinstance-does-not-trigger-the-specified-listeners/2881 "2018-11-09T14:01:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![enchobelezirev](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/enchobelezirev/32/604_2.png) [@enchobelezirev](https://forum.flowable.org/u/enchobelezirev)\
**Post date:** [November 9, 2018, 2:01pm UTC](https://forum.flowable.org/t/runtimeservice-deleteprocessinstance-does-not-trigger-the-specified-listeners/2881/1 "2018-11-09T14:01:48Z")

</div>

Greetings, Flowable experts, 🙂

I have the following scenario:

1. I start a process instance using the method RuntimeService::startProcessInstance
2. When the process is started, I am monitoring it(check whether it is completed, running or in error).
3. So far so good, but I have the requirement to be able to remove already running processes. So, I decided to use the method from RuntimeService::deleteProcessInstance.
4. When the process is removed I want to collect some data from it(am using the event which is triggered and from it I am taking the process instance id and based on it i am making queries in order to get the data i need from the database) before it is really deleted. Here comes the problem, I do not see the listener to be triggered when I delete the process instance.  
Here is a snippet from the bpmn diagram of the process:

> \<extensionElements\>
> 
> \<flowable:eventListener class=“parallel.flowable.test.DeleteProcessListener” entityType=“process-instance” events=“PROCESS\_CANCELLED”/\>
> 
> \</extensionElements\>

I have a log message in the listener which prints message to the console when it is triggered.  
Here come the strange thing - when I remove the **entityType=“process-instance”** , the event listener is triggered and the log message appears in the console.

Could you share with me why this could happen? Am I doing something wrong here?

I am attaching github project.(ignore that there is a CallActivity element in it - it was used for other examples in the forum). You can run the test using the main method in the TestEventListener class.

Project: [GitHub - enchobelezirev/flowable-test](https://github.com/enchobelezirev/flowable-test)

The diagram is here: [flowable-test/src/main/resources/diagrams/main-process.bpmn at master · enchobelezirev/flowable-test · GitHub](https://github.com/enchobelezirev/flowable-test/blob/master/src/main/resources/diagrams/main-process.bpmn)

The test that checks the problem is here: [flowable-test/src/main/java/parallel/flowable/test/TestEventlistener.java at master · enchobelezirev/flowable-test · GitHub](https://github.com/enchobelezirev/flowable-test/blob/master/src/main/java/parallel/flowable/test/TestEventlistener.java)

Thanks and best regards,  
Encho
