Best practice - parent / variable child relationship

How best to model for say manufacturing a product with variable parts where a workflow is launched for each part but you don’t know a priori which or how many if these will be present?

Imagine the process for making a custom ordered car with various features. The overall product level workflow may be generic but based on the specs various workflows would be launch to add on the desired features,

Maybe a step would exist in the parent workflow to determine which child workflows to launch and kick them off. A subsequent step would wait for them all to end before moving on.

How should such inter workflow communication be done? Via messages and a loop that waits for all N children to signal completion? Any ideas?

Can you upload some kind of draft model of what you’re trying to do, it might help better understand what you’re trying to do


So we start with a high level (parent) workflow with a step that figures out which child workflow instances to launch. I’m considering perhaps using subprocesses here instead however the decision on which ones to run involves a rules engine which is why it’s a call out to a service to do presently. Maybe we could make use of DMN (Camunda’s decision table support instead).

At any rate, keeping with this, lets say that the desired options to add on out of a possible set of say 25 different ones are just 2 - a spoiler and a sound system.

So here are those two. The last step is one to send a message back to the parent to say hey I’m done. Now what’s lacking here is that the parent is only keeping track of a count of expected completions. What if there’s a failure - how can you tell what failed to respond? So not found of this. We could also use named signals instead but that doesn’t improve things much.

Thoughts on how to better model the linkage between these?

thanks

Hi @ddrouin,

a multi instance call activity can call as many subprocesses as needed.

Hope this helps, Ingo

Hi Ingo - and thanks

So we’d have to determine which workflow instances to launch - say the spoiler and sound system ones out of the possible N workflows. Include those names as the Collection value at run time somehow and the activity would actually launch the workflows. I’m unclear on how it would wait until the entire child workflow completes - like wouldn’t it just consider the activity as “done” once it launched the workflow? Maybe if these were instead subprocesses that would work but then you need to embed all N of them into the parent workflow or am I misunderstanding?

thanks!

Hi @ddrouin,

the multi instance will wait untill all started activities are completed. Out of the box.

The call activity will wait until the called sub process is completed.

A call activity will run the process from a separate diagram.

See https://docs.camunda.org/manual/7.10/reference/bpmn20/ for further details.

Hope this helps, Ingo

Hi Ingo,

Great I see now. So I can just put the Id of the separate BPMN diagram as the Called Element presumably and it’ll run N of these based on the Loop Cardinality - and it’ll wait until they’re all done.

I don’t see a way yet to have this run a variable set of diagrams however - like run these 3 separate ones in parallel out of potentially 25. Still I could use this for calling a single diagram with branching logic to select the right embedded subprocess based on an element variable possibly.

Hi @ddrouin,

I would do the selection in the “determine options” service task. Add a list with the called elements to the process variables.

Hope this helps, Ingo

Hi Ingo - that sounds very promising - I’ll give that a try. Thanks!

I tried this out with the two production definition keys returned in a process variable. This process variable was set as the Collections value in the BPMN model via Camunda modeler. The result of executing the multi-instance Call Activity was that the single BPMN that was defined in the activity (unrelated to the collection variable) was what was called - twice. That makes sense since it is what was defined statically in the model. It is not what we need to do though. Somehow, instead of a single workflow (diagram), we need to spawn a collection of diagrams here - the ones in the collection. How can this be done?