<?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 Transaction driven events in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/transaction-driven-events/m-p/195698#M148828</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;A colleague of mine reported &lt;/SPAN&gt;&lt;A href="https://jira.codehaus.org/browse/ACT-2040" rel="nofollow noopener noreferrer"&gt;https://jira.codehaus.org/browse/ACT-2040&lt;/A&gt;&lt;SPAN&gt; a while ago. I have recently attempted to address the issue myself and thought I'd report on my findings and see if I can get some feedback on the approach.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As a quick summary, the issue was that although an ActivitiEvent may come in to our implementation of ActivitiEventListener, there was no guarantee that the transaction relating to that event had completed so we could not use events to drive UI updates that query activiti services.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The approach I am trying to take is as follows:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; - When an (appropriate) event comes in to the listener&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; - get the command context for the current thread (assuming the event is fired on the expected thread)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; - get the transaction context from the command context&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; - add a listener to the transaction context for &lt;/SPAN&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;TransactionState.COMMITTED&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt; - in the listener, fire the UI update&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This seems to work as expected which is great.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The concern I have is that there is no removeTransactionListener method or implementations in the transaction context. This is presumably because the transaction context is thrown away once the transaction is committed.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would value your opinion on this approach and would like to confirm that my assumptions of events always being fired on an appropriate thread to get the command context from and that transaction contexts are thrown away once a transaction is committed are true.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 14 Aug 2014 11:09:19 GMT</pubDate>
    <dc:creator>mishamo</dc:creator>
    <dc:date>2014-08-14T11:09:19Z</dc:date>
    <item>
      <title>Transaction driven events</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/transaction-driven-events/m-p/195698#M148828</link>
      <description>Hi,A colleague of mine reported https://jira.codehaus.org/browse/ACT-2040 a while ago. I have recently attempted to address the issue myself and thought I'd report on my findings and see if I can get some feedback on the approach.As a quick summary, the issue was that although an ActivitiEvent may c</description>
      <pubDate>Thu, 14 Aug 2014 11:09:19 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/transaction-driven-events/m-p/195698#M148828</guid>
      <dc:creator>mishamo</dc:creator>
      <dc:date>2014-08-14T11:09:19Z</dc:date>
    </item>
    <item>
      <title>Re: Transaction driven events</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/transaction-driven-events/m-p/195699#M148829</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I also realised that no events seem to be fired after a call to &amp;lt;code&amp;gt;taskService.unclaim(taskId)&amp;lt;/code&amp;gt;. Is that by design or an oversight? I suppose I would expect at least a TASK_ASSIGNED event to be fired.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Aug 2014 11:56:40 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/transaction-driven-events/m-p/195699#M148829</guid>
      <dc:creator>mishamo</dc:creator>
      <dc:date>2014-08-14T11:56:40Z</dc:date>
    </item>
    <item>
      <title>Re: Transaction driven events</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/transaction-driven-events/m-p/195700#M148830</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;In Activiti 5.16, there is an easier way now: see &lt;/SPAN&gt;&lt;A href="https://github.com/Activiti/Activiti/blob/master/modules/activiti-engine/src/main/java/org/activiti/engine/impl/event/logger/EventLogger.java" rel="nofollow noopener noreferrer"&gt;https://github.com/Activiti/Activiti/blob/master/modules/activiti-engine/src/main/java/org/activiti/engine/impl/event/logger/EventLogger.java&lt;/A&gt;&lt;SPAN&gt; , the onEvent method. You can add stuff to the current command context and also get a close notification.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt; I also realised that no events seem to be fired after a call to taskService.unclaim(taskId)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That does sound like a bug to me.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Aug 2014 09:50:31 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/transaction-driven-events/m-p/195700#M148830</guid>
      <dc:creator>jbarrez</dc:creator>
      <dc:date>2014-08-19T09:50:31Z</dc:date>
    </item>
    <item>
      <title>Re: Transaction driven events</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/transaction-driven-events/m-p/195701#M148831</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm assuming you're referring to the &amp;lt;code&amp;gt;CommandContextCloseListener&amp;lt;/code&amp;gt;. In that case, is there any difference between the command context being closed and the transaction context being closed?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regarding the bug, shall I raise it in JIRA?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Aug 2014 15:44:40 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/transaction-driven-events/m-p/195701#M148831</guid>
      <dc:creator>mishamo</dc:creator>
      <dc:date>2014-08-19T15:44:40Z</dc:date>
    </item>
    <item>
      <title>Re: Transaction driven events</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/transaction-driven-events/m-p/195702#M148832</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;&amp;gt; In that case, is there any difference between the command context being closed and the transaction context being closed?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Yes, the command context close happens after transaction commit, but just before the transaction context is closed &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt; Regarding the bug, shall I raise it in JIRA?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Not needed, already fixed it&amp;nbsp; today in&amp;nbsp; &lt;/SPAN&gt;&lt;A href="https://github.com/Activiti/Activiti/commit/a30b42bd423dc3ce4754bafa18adbcc6decd00fd" rel="nofollow noopener noreferrer"&gt;https://github.com/Activiti/Activiti/commit/a30b42bd423dc3ce4754bafa18adbcc6decd00fd&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Aug 2014 20:45:58 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/transaction-driven-events/m-p/195702#M148832</guid>
      <dc:creator>jbarrez</dc:creator>
      <dc:date>2014-08-19T20:45:58Z</dc:date>
    </item>
  </channel>
</rss>

