cancel
Showing results for 
Search instead for 
Did you mean: 

How to destroy all async embedded subprocesses

fritz128
Champ in-the-making
Champ in-the-making
What I have:
user_task_in _main_process from which I start many embedded subprocess by signal.

What I want:
When one of subprocesses achieve success, I want to complete it and destroy all other subprocesses. By destroy I mean stop it abruptly without further  continuation.

What a problem:
I suggest that all async subprocesses should be ended when I complete an user_task_in _main_process, but they doesn't!

Question:
How correctly destroy async embeded subprocesses?
3 REPLIES 3

frederikherema1
Star Contributor
Star Contributor
Wrap the user_task_in _main_process in a embedded subprocess, with a boundary-event on it, with "cancelActivity=true". Have the successfull async subprocess trigger that boundary-event (e.g.. signal). When the boundary-event is intercepted, the scope will be destroyed and all scopes (subprocesses) in it are as well.

Another solution is, in case all the async-subprocesses are the same, to use a multi-instance subprocess (parallel). Put a completion-condition on the multi-instance that is met when one of the subprocesses ends. if one of them ends, the "multi-instance" will end and destroy all other subprocesses part of this multi-instance

aurelienpel
Champ in-the-making
Champ in-the-making
I have the same problem, so I followed the second solution with a multi instance subprocess as you can see attached, but I don't know where to add the completion-condition. Do you have any example ? Or in my example, did I forget something ? If yes, what and where, if no, where do I have to add the condition to destroy ?

Thanks for your help !

Aurelien

jbarrez
Star Contributor
Star Contributor
The completion condition is a property of the multi instance …. And it is not shown in the diagram. There is an example in the user guide that shows the xml.