cancel
Showing results for 
Search instead for 
Did you mean: 

Return to calling process but continue asyncronously

mlueck
Champ in-the-making
Champ in-the-making
Hi,

we have the following setting:
  • A Parent process which calls another process (the child) via call activiti and defined out parameters for this call because we need an result from the child in the parent
  •  
  • After the child has created the needed result we want to pass this to the parent and continue with some other activities in the child
Is this even possible?

We've tried parallel gateways in the child but it didn't work. So we tried to define the async part of the child in an subprocess of the child and made the subprocess ativity and the start event of the subprocess async. dind't work either. So we tried to combine parallel gateways and subprocess but it didn't work either.

We could create a new process definition for the asynchronous part of the child and start a new process instance for it for example via camel. But we'd like to keep it in the child because it's related from the business view.

I added two example processes in the hope the clearify the idea.
1 ACCEPTED ANSWER

warper
Star Contributor
Star Contributor
You can set parent process variables from child process. It looks like execution.getParent().setVariable("a","a-value")
You can send signals/messages to parent process. To avoid transaction context nesting you may need async signals, but it's up to you.
So, you can make parallel gateway in parent process, top line waits on signal, bottom line does call activity. Child process sets variables of parent process, then sends signal and continues its work as needed.

View answer in original post

3 REPLIES 3

mlueck
Champ in-the-making
Champ in-the-making
Ok after more searches in the forums i found this thread.

Basically it's stating that a CallActiviti must always wait for the called process instance to finish.

As far as i understood subprocesses and CallActivity's are not very different in the way there are executed. Actually The CallActivityBehavoiur is implementation of the SubprocessBehavior. The CallActivity will not leave until the called is finished.

I assume that the called process is not finished until all end states are reached.

warper
Star Contributor
Star Contributor
You can set parent process variables from child process. It looks like execution.getParent().setVariable("a","a-value")
You can send signals/messages to parent process. To avoid transaction context nesting you may need async signals, but it's up to you.
So, you can make parallel gateway in parent process, top line waits on signal, bottom line does call activity. Child process sets variables of parent process, then sends signal and continues its work as needed.

mlueck
Champ in-the-making
Champ in-the-making
Hi,

thanks for the answer. I already had a look at events and stuff and now connected parent and child through a message event.
The parent call activiti get's an non interupting message boundary catch event which leads to an service task which will sent a message to an external system.  The child process has a script task which will sent a message event to the parent and then proceed which the remainder of the process.

The CallActiviti will still wait for the subprocess to complete but that's ok. So it would also be possible to to more things in the parent if necessary.

If you're interested or if anybody has the same issue i uploaded a test project to github which contains the processes and a junit test to show the usage.