Best practices for starting processes and waiting for them to complete

Hello,

I have a use case where the multi-instance call activity does not work for me - I need to spin up several thousand sub-processes which seems to time out and cause issues. I have tried using messages to start the processes, but can’t get things working properly.

Here is what I currently have, which consists of a parent and child process.

parent:

child:

The intent is for the parent process to spawn 1000 child processes, then move on to a wait state while they complete. An event subprocess counts the messages that come in from the child processes as they complete, then sends a message to the main process to continue once it has heard from all children.

Unfortunately this method is fraught with OptimisticLockingExceptions and Deadlocks in the Camunda Process Engine, and I am not quite sure why. The entire event subprocess and all its components are exclusive. Out of 1000, I usually get around 50 or so incidents in the child processes.

Any ideas on what is a better pattern here? In my actual models, the “Do some work” in the child is an external task that can take up to a couple of hours to complete.

1 Like