AnsweredAssumed Answered

User Task -> Script Task -> User Task = Task Query timing problem

Question asked by robojeff on Oct 18, 2016
Latest reply on Oct 19, 2016 by robojeff
A portion of my workflow has this design:

User Task –> Script Task (synchronous) –> User Task

We 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 completed the workflow advances to the following Script task, which executes synchronously.  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).

While this is happening, the REST client has already made another request to query for the user's tasks.  Since the workflow has not yet advances to the next User Task, the REST client has no task to display to the user.

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.

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?