<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Timer triggers entity deleted event in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/timer-triggers-entity-deleted-event/m-p/3428#M1308</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mihail,&lt;/P&gt;&lt;P&gt;in my opinion this is a bug. You could raise a jira issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Niklas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 20 Jan 2017 15:34:24 GMT</pubDate>
    <dc:creator>nikmenke</dc:creator>
    <dc:date>2017-01-20T15:34:24Z</dc:date>
    <item>
      <title>Timer triggers entity deleted event</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/timer-triggers-entity-deleted-event/m-p/3419#M1299</link>
      <description>Hi all,I am adopting activiti version 5.22.0 and I've noticed the following behavior: when a timer is started&amp;nbsp;an entity deleted event is triggered with no delete reason specified. I'm attaching a unit test which illustrates this behavior. I have added an EventListener, which is notified when an "ENT</description>
      <pubDate>Thu, 19 Jan 2017 17:04:46 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/timer-triggers-entity-deleted-event/m-p/3419#M1299</guid>
      <dc:creator>mortalcombat</dc:creator>
      <dc:date>2017-01-19T17:04:46Z</dc:date>
    </item>
    <item>
      <title>Re: Timer triggers entity deleted event</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/timer-triggers-entity-deleted-event/m-p/3420#M1300</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;SPAN style="color: #727174; background-color: #ffffff;"&gt;Mihail,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #727174; background-color: #ffffff;"&gt;this is the correct behaviour. In your unit test you start an instance of the process. The instance will be returned if the process reaches the first wait state. The timer is such a wait state. So the timer is created and the startProcess method returns the instance. Furthermore it is the end of the test. Therefore the deployment will be deleted and the event is triggered. If you would add a line like TimeUnit.SECONDS.sleep(30) the second service task would be executed too.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #727174; background-color: #ffffff;"&gt;Niklas&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jan 2017 21:06:24 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/timer-triggers-entity-deleted-event/m-p/3420#M1300</guid>
      <dc:creator>nikmenke</dc:creator>
      <dc:date>2017-01-19T21:06:24Z</dc:date>
    </item>
    <item>
      <title>Re: Timer triggers entity deleted event</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/timer-triggers-entity-deleted-event/m-p/3421#M1301</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Niklas,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As far as I understand, when the first wait state is reached it's expected that the process instance will get&amp;nbsp;deleted and therefore the listener gets triggered ? Should this event get triggered for&amp;nbsp;each&amp;nbsp;wait state, e.g. if i have a flow like &lt;EM&gt;start-&amp;gt;task-&amp;gt;&lt;STRONG&gt;timer&lt;/STRONG&gt;-&amp;gt;task-&amp;gt;&lt;STRONG&gt;timer&lt;/STRONG&gt;-&amp;gt;task-&amp;gt;end &amp;nbsp;&lt;/EM&gt;would this event get triggered twice ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, this behavior is not observed in version 5.15.1, as I'm currently updating my project from 5.15.1 to 5.22.0 and I have similar event listeners, which didn't get triggered in this case before. Would you know if this is a new feature introduced somewhere in the range of [ 5.15.1; 5.22.0 ] version of the engine ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Mihail&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jan 2017 11:41:30 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/timer-triggers-entity-deleted-event/m-p/3421#M1301</guid>
      <dc:creator>mortalcombat</dc:creator>
      <dc:date>2017-01-20T11:41:30Z</dc:date>
    </item>
    <item>
      <title>Re: Timer triggers entity deleted event</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/timer-triggers-entity-deleted-event/m-p/3422#M1302</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mihail,&lt;/P&gt;&lt;P&gt;when the first wait state is reached the process will be persisted. At that moment the current thread finished the method startProcessInstanceByKey and returns the process instance. So the test will be ended and the deployment will be deleted.&lt;/P&gt;&lt;P&gt;The timer would&amp;nbsp;now be handled by the jobexecutor or asyncexecutor. I have noticed that you did not activated one of them.&amp;nbsp;So your second service task would never been executed because the process will never be triggered&amp;nbsp;to continue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This event triggers anytime a entity is deleted. So if your unit-test passes with the activation of the asyncexecutor and adding a sleep it will be triggered several&amp;nbsp;times.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just add those lines to the processEngineConfiguration in your activiti.cfg.xml:&lt;/P&gt;&lt;P&gt;&amp;lt;property name="jobExecutorActivate" value="false" /&amp;gt;&lt;BR /&gt; &amp;lt;property name="asyncExecutorEnabled" value="true" /&amp;gt;&lt;BR /&gt; &amp;lt;property name="asyncExecutorActivate" value="true" /&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps&lt;/P&gt;&lt;P&gt;Niklas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jan 2017 12:21:01 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/timer-triggers-entity-deleted-event/m-p/3422#M1302</guid>
      <dc:creator>nikmenke</dc:creator>
      <dc:date>2017-01-20T12:21:01Z</dc:date>
    </item>
    <item>
      <title>Re: Timer triggers entity deleted event</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/timer-triggers-entity-deleted-event/m-p/3423#M1303</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Niklas,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have made the modifications you mentioned. I have also&amp;nbsp;modified the listener to display the activityId when it is triggered. Now the second service task gets executed as well, and the event listener gets triggered two times -&amp;gt; one time for the timer and one time for the endEvent.&lt;/P&gt;&lt;P&gt;When I run the same test using version 5.15.1 of the engine, however, the event listener doesn't get triggered at all. Is this a bug in the 5.15.1 version or is this a feature introduced somewhere between 5.15.1 and 5.22.0 ? I could attach the modified archive if you'd like.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Mihail&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jan 2017 12:54:02 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/timer-triggers-entity-deleted-event/m-p/3423#M1303</guid>
      <dc:creator>mortalcombat</dc:creator>
      <dc:date>2017-01-20T12:54:02Z</dc:date>
    </item>
    <item>
      <title>Re: Timer triggers entity deleted event</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/timer-triggers-entity-deleted-event/m-p/3424#M1304</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Michail,&lt;/P&gt;&lt;P&gt;the first time the events triggers your listener the execution for the timer is deleted. The second time the execution(ProcessInstance) for the tasks is&amp;nbsp;deleted.&lt;/P&gt;&lt;P&gt;Step1: StartEvent -&amp;gt; ProcessInstance created&lt;/P&gt;&lt;P&gt;Step1: ServiceTask1&lt;/P&gt;&lt;P&gt;Step2: TimerEvent -&amp;gt; TimerExecution created, ProcessInstance suspended&lt;/P&gt;&lt;P&gt;Step3: Timer fired -&amp;gt; ProcessInstance activated, TimerExecution deleted (Listener triggered)&lt;/P&gt;&lt;P&gt;Step4: ServiceTask2&lt;/P&gt;&lt;P&gt;Step5: EndEvent -&amp;gt; ProcessInstance deleted (Listener triggered)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But i don't know if this was the behaviour before v. 5.22.0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Niklas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jan 2017 14:07:20 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/timer-triggers-entity-deleted-event/m-p/3424#M1304</guid>
      <dc:creator>nikmenke</dc:creator>
      <dc:date>2017-01-20T14:07:20Z</dc:date>
    </item>
    <item>
      <title>Re: Timer triggers entity deleted event</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/timer-triggers-entity-deleted-event/m-p/3425#M1305</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Niklas,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have modified the bpmn diagram so that the listener would get triggered only for process-instance entity type by adding the following:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;lt;activiti:eventListener events="ENTITY_DELETED" entityType="process-instance" class="test.tasks.MyEventListener"&amp;gt;&amp;lt;/activiti:eventListener&amp;gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;According to your previous statement, as far as I understand, now the listener should get triggered once, when the endEvent is reached and the ProcessInstance gets deleted. It is, however, still triggered for the timer. Should the "&lt;SPAN style="color: #727174; background-color: #ffffff;"&gt;TimerExecution deleted"&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #727174; background-color: #ffffff;"&gt;trigger the listener ? Or there is a process instance created and then deleted for each timer ?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #727174; background-color: #ffffff;"&gt;Mihail&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jan 2017 14:50:30 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/timer-triggers-entity-deleted-event/m-p/3425#M1305</guid>
      <dc:creator>mortalcombat</dc:creator>
      <dc:date>2017-01-20T14:50:30Z</dc:date>
    </item>
    <item>
      <title>Re: Timer triggers entity deleted event</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/timer-triggers-entity-deleted-event/m-p/3426#M1306</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mihail,&lt;/P&gt;&lt;P&gt;i agree with you. That should not happen. But there&amp;nbsp;is still no second ProcessInstance. If you would modify your listener a little bit you would get a better output. Something like this maybe:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;public void onEvent(ActivitiEvent event) {&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;try {&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (((ExecutionEntity) ((ActivitiEntityEventImpl) event).getEntity()).getDeleteReason() == null) {&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;System.out.println("Event listener triggered: " + event.getType() + " " + ((ExecutionEntity) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;((ActivitiEntityEventImpl) event).getEntity())+ " " + ((ExecutionEntity)((ActivitiEntityEventImpl) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;event).getEntity()).getParentId());&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&amp;nbsp;&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;} catch (ClassCastException e) {&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Output:&lt;/P&gt;&lt;P&gt;Test service task &lt;BR /&gt;Event listener triggered: ENTITY_DELETED Execution[7] 4&lt;BR /&gt;Another test service task &lt;BR /&gt;Event listener triggered: ENTITY_DELETED ProcessInstance[4] null&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As you can see there is an execution and a processinstance. The main difference of both is that the processinstance has no parent execution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Niklas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jan 2017 15:06:14 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/timer-triggers-entity-deleted-event/m-p/3426#M1306</guid>
      <dc:creator>nikmenke</dc:creator>
      <dc:date>2017-01-20T15:06:14Z</dc:date>
    </item>
    <item>
      <title>Re: Timer triggers entity deleted event</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/timer-triggers-entity-deleted-event/m-p/3427#M1307</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Niklas,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've modified the listener as you've said and indeed it gets triggered for the entity type Execution. But I have configured it to be triggered &lt;STRONG&gt;only&lt;/STRONG&gt; for&amp;nbsp;entityType="process-instance". For now I will apply the workaround you've suggested, but is this considered a bug ? If so, should I track it somewhere ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot for your support !&lt;BR /&gt;Mihail&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jan 2017 15:27:14 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/timer-triggers-entity-deleted-event/m-p/3427#M1307</guid>
      <dc:creator>mortalcombat</dc:creator>
      <dc:date>2017-01-20T15:27:14Z</dc:date>
    </item>
    <item>
      <title>Re: Timer triggers entity deleted event</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/timer-triggers-entity-deleted-event/m-p/3428#M1308</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mihail,&lt;/P&gt;&lt;P&gt;in my opinion this is a bug. You could raise a jira issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Niklas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jan 2017 15:34:24 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/timer-triggers-entity-deleted-event/m-p/3428#M1308</guid>
      <dc:creator>nikmenke</dc:creator>
      <dc:date>2017-01-20T15:34:24Z</dc:date>
    </item>
    <item>
      <title>Re: Timer triggers entity deleted event</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/timer-triggers-entity-deleted-event/m-p/3429#M1309</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Niklas,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've raised a bug here:&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jan 2017 16:50:11 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/timer-triggers-entity-deleted-event/m-p/3429#M1309</guid>
      <dc:creator>mortalcombat</dc:creator>
      <dc:date>2017-01-20T16:50:11Z</dc:date>
    </item>
    <item>
      <title>Re: Timer triggers entity deleted event</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/timer-triggers-entity-deleted-event/m-p/3430#M1310</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Niklas,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could there a be a better workaround for this ? I mean, all those casts to get the deleteReason are not very pleasant to look at. Is it possible to get the entity in a more elegant way ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Mihail&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Feb 2017 15:05:36 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/timer-triggers-entity-deleted-event/m-p/3430#M1310</guid>
      <dc:creator>mortalcombat</dc:creator>
      <dc:date>2017-02-01T15:05:36Z</dc:date>
    </item>
  </channel>
</rss>

