<?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 Persistance race condition in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/persistance-race-condition/m-p/131412#M92332</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;&amp;nbsp; We are using Activiti in perhaps a very different way and running into some problems.&amp;nbsp; Our app is distributed across multiple servers, connected by a message queue.&amp;nbsp; A single server runs an embedded version of Activiti.&amp;nbsp; When the workflows hit a particular custom task, we post a message to the message queue inside a subclass of TaskActivityBehavior (but the problem shows up using JavaDelegate as well).&amp;nbsp; Another server picks up the message and does some processing and sets a variable on the workflow like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; runtimeService.setVariable(request.executionId, "SeriesObject", seriesObject);&lt;BR /&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;Depending on the timing, the call to setVariable may throw an exception because the workflow (running on a different machine), may not have persisted the execution to the database yet.&amp;nbsp; Sometimes it works just fine.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My question: how should we handle this problem?&amp;nbsp; Can we/should we&lt;/SPAN&gt;&lt;BR /&gt;&lt;UL&gt;1. force the workflow to persist before we send the message to the message queue?&lt;/UL&gt;&lt;UL&gt;2. use Activiti's transaction manager to make sure the message is sent only after the workflow is persisted?&lt;/UL&gt;&lt;UL&gt;3. have a callback to know when Activiti persists the execution?&lt;/UL&gt;&lt;UL&gt;4. delay the send until the workflow is persisted? (Don't like this option, would be a spin lock)&lt;/UL&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-dan&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 07 Dec 2012 15:34:14 GMT</pubDate>
    <dc:creator>blezek</dc:creator>
    <dc:date>2012-12-07T15:34:14Z</dc:date>
    <item>
      <title>Persistance race condition</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/persistance-race-condition/m-p/131412#M92332</link>
      <description>Hi,&amp;nbsp; We are using Activiti in perhaps a very different way and running into some problems.&amp;nbsp; Our app is distributed across multiple servers, connected by a message queue.&amp;nbsp; A single server runs an embedded version of Activiti.&amp;nbsp; When the workflows hit a particular custom task, we post a message to the</description>
      <pubDate>Fri, 07 Dec 2012 15:34:14 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/persistance-race-condition/m-p/131412#M92332</guid>
      <dc:creator>blezek</dc:creator>
      <dc:date>2012-12-07T15:34:14Z</dc:date>
    </item>
    <item>
      <title>Re: Persistance race condition</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/persistance-race-condition/m-p/131413#M92333</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Personally I think two is the best. It is the most natural way and the way transactios are meant to be used.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Dec 2012 16:52:36 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/persistance-race-condition/m-p/131413#M92333</guid>
      <dc:creator>ronald_van_kuij</dc:creator>
      <dc:date>2012-12-07T16:52:36Z</dc:date>
    </item>
    <item>
      <title>Re: Persistance race condition</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/persistance-race-condition/m-p/131414#M92334</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Personally I think two is the best. It is the most natural way and the way transactios are meant to be used.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;Agreed.&amp;nbsp; Can you point out where I can grab the current transaction from within a JavaDelegate?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-dan&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Dec 2012 17:02:43 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/persistance-race-condition/m-p/131414#M92334</guid>
      <dc:creator>blezek</dc:creator>
      <dc:date>2012-12-07T17:02:43Z</dc:date>
    </item>
    <item>
      <title>Re: Persistance race condition</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/persistance-race-condition/m-p/131415#M92335</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Seems that &lt;/SPAN&gt;&lt;A href="http://do-on-it.blogspot.com/2012/02/spring-database-transactions-before.html" rel="nofollow noopener noreferrer"&gt;this post [1]&lt;/A&gt;&lt;SPAN&gt; was key to helping me out…&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the tips!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-dan&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[1] &lt;/SPAN&gt;&lt;A href="http://do-on-it.blogspot.com/2012/02/spring-database-transactions-before.html" rel="nofollow noopener noreferrer"&gt;http://do-on-it.blogspot.com/2012/02/spring-database-transactions-before.html&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Dec 2012 18:19:26 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/persistance-race-condition/m-p/131415#M92335</guid>
      <dc:creator>blezek</dc:creator>
      <dc:date>2012-12-07T18:19:26Z</dc:date>
    </item>
  </channel>
</rss>

