<?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 User Task -&amp;gt; Script Task -&amp;gt; User Task = Task Query timing problem in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/user-task-gt-script-task-gt-user-task-task-query-timing-problem/m-p/240698#M193828</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;A portion of my workflow has this design:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;User Task –&amp;gt; Script Task (synchronous) –&amp;gt; User Task&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;We have a REST client that frequently polls Activiti for the following information:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1. What is the status of my workflow?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2. What task does my user need to complete next?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When the first task shown above is completed the workflow advances to the following Script task, which executes synchronously.&amp;nbsp; It's job is to update some process instance variables that provide the status of the user's workflow (this is the information queried in request #1 described above).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;While this is happening, the REST client has already made another request to query for the user's tasks.&amp;nbsp; Since the workflow has not yet advances to the next User Task, the REST client has no task to display to the user.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;We're going to try changing the Script Task to execute asynchronously, but I still have concerns that this timing issue may only mask a deeper design flaw that we've created.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there a better workflow design strategy I should be implementing to update process instance variables on completion of a task? If I moved this logic to a Java TaskListener, would that listener be guaranteed to complete before control is returned back to the client after completing the task?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Jeff&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 18 Oct 2016 16:04:40 GMT</pubDate>
    <dc:creator>robojeff</dc:creator>
    <dc:date>2016-10-18T16:04:40Z</dc:date>
    <item>
      <title>User Task -&gt; Script Task -&gt; User Task = Task Query timing problem</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/user-task-gt-script-task-gt-user-task-task-query-timing-problem/m-p/240698#M193828</link>
      <description>A portion of my workflow has this design:User Task –&amp;gt; Script Task (synchronous) –&amp;gt; User TaskWe have a REST client that frequently polls Activiti for the following information:1. What is the status of my workflow?2. What task does my user need to complete next?When the first task shown above is</description>
      <pubDate>Tue, 18 Oct 2016 16:04:40 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/user-task-gt-script-task-gt-user-task-task-query-timing-problem/m-p/240698#M193828</guid>
      <dc:creator>robojeff</dc:creator>
      <dc:date>2016-10-18T16:04:40Z</dc:date>
    </item>
    <item>
      <title>Re: User Task -&gt; Script Task -&gt; User Task = Task Query timing problem</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/user-task-gt-script-task-gt-user-task-task-query-timing-problem/m-p/240699#M193829</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Update…&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;We've been trying to confirm if the Activiti engine blocks on a call to complete a task until the workflow reaches a subsequent User Task or the process ends.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;We've moved the Groovy script code from the Script Task that sits between the two User Tasks to a ScriptExecutionListener attached to the first User Tasks's "end" event.&amp;nbsp; We put a 30 second delay at the start of the script.&amp;nbsp; When we run our unit tests we do see that completing the 1st task is a blocking call (&amp;gt; 30 seconds) until the ScriptExecutionListener completes its job and the next User task becomes the active step in the workflow.&amp;nbsp; However, we still are still observing a problem with our Web client requesting tasks and not getting any results.&amp;nbsp; Refreshing the page gets the results.&amp;nbsp; So somewhere we've got a race condition.&amp;nbsp; We just don't know if it's in the client or the workflow itself.&amp;nbsp; Looking at the timing of the web requests, they appear to all be in the correct sequence.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So here's what I need to know from the experts on this forum:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1. Do all TaskListeners and ExecutionListeners attached to a task's "complete" or "end" events execute on the same thread as the request to complete the task (meaning, is the client blocked until all listeners complete executing)?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2. Is the client blocked on the call to complete a task until the workflow reaches a subsequent User Task or the process ends? (I assume that any intermediate behaviors configured to execute asynchronously do not block the client).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Jeff&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Oct 2016 18:16:35 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/user-task-gt-script-task-gt-user-task-task-query-timing-problem/m-p/240699#M193829</guid>
      <dc:creator>robojeff</dc:creator>
      <dc:date>2016-10-19T18:16:35Z</dc:date>
    </item>
  </channel>
</rss>

