Consider a simple workflow:
Start->Step1->Step2->Step3->Step4->Step5->End
What is the best way to start a subprocess in parallel (e.g. send message) optionally from either one of the steps between Step2
to Step4
? For example, at Step2
, under certain condition, it could start a subprocess in parallel, and merge back with Step5
. Then the two parallel flows are:
Start->Step1->Step2->Step3->Step4->Step5->End ->Subprocess.........->
Another example, the subprocess could start from Step3
, i.e.
Start->Step1->Step2->Step3->Step4->Step5->End ->Subprocess..->
Or, the subprocess may not start at all, i.e. only this:
Start->Step1->Step2->Step3->Step4->Step5->End
This is a much-simplified case. The real workflow is more complex, involving more tasks, gateways, and even subprocesses between Step1
to Step5
. So it seems not a good idea to manually add conditions at every step to start the subprocess.
You can create a scope around the steps during which the parallel operation should be possible by using an embedded sub process. Then you can attach a non-interrupting message event handler to this scope. The event handler then triggers the parallel process.
The same can also be done, within an embedded sub processes or within the parent, with an event-based sub process.
https://docs.camunda.io/docs/components/modeler/bpmn/embedded-subprocesses/
https://docs.camunda.io/docs/components/modeler/bpmn/event-subprocesses/
The synchronization at the last step can be done via a message, signal or conditional event.