I have a parent process which starts N subprocesses in parallel. At the end of those N process I need to perform a single operation on the aggregated result of the subprocesses (i.e. if each of the subprocess at its last state sets a certain variable, I need to collect those value in a list and persist them).
What’s the correct approach to do it without incurring in race conditions?
Surprised this wasn’t addressed. I am wondering the same thing.
Please share your scenario and bpmn file so we can address you use case better.
But I think Multiple instance docs could help you.
Hi @Edmondo_Porcu, @rmoskal
You could define a collection type variable (for example: ArrayList) on parent process scope. (Define it using “Execution Listener” on the start of the (split) parallel gateway)
Then define a local variable on each sub-process scope. (Define it using “Execution Listener” on the start of each sub-process or on ending a start event of each sub-process)
And before execution arrives the (joining) parallel gateway, make sure to add that local variable’s value to the parent collection variable.(Using “Execution Listener” on the end of each sub-process or on starting an end event of each sub-process)
Please have a look at below link
Also this has been addressed various times with the looping pattern shown in DMN: Pattern Review: DMN Looping for Array Input