Accessing variables of Call Activity comprised of long running Async Service Tasks


I have a question regarding Call Activity comprising of Async Service Tasks.

Here is a brief description of my workflow

  1. Parent workflow looks like following:

Start event -> Call Activity 1 -> Receive Task -> Call Activity 2 -> End Event.

  1. Call Activity 1 calls a workflow that is comprised of synchronous Service Tasks and is invoked via custom rest API. Once the Call Activity 1 completes, output variables are fetched from parent Process Instance. So far so good.

  2. Parent process instance goes into wait state, as soon as it hits receive task.

  3. Another custom Rest API triggers the Receive task message that “wakes up” the workflow to execute “Call Activity 2”.

  4. Call Activity 2 has two service tasks. First Service task is synchronous and after performing its job, it sets some variables. Second service task is a long running asynchronous task and is executed in a separate thread(execution).

My question is:
How can I retrieve the variables set by first service task in Call Activity 2 from the parent process instance? I need to retrieve these variables before the workflow called from Call Activity 2 completes.

My understanding is that variables from call activity(OUT variables) are not available to parent process instance until the workflow called by call activity completes. Is there any workaround to this?

I hope my question makes sense. If not, let me know and I can clarify.


Correct. You could add service task/listener that would call getSuperExecution() (that’s the parent process) and set the variable there.