Dynamic parallel fork-join

Hello Gurus.
Didn’t find the answer to my question in existing topics.
We’ve had previously JBPM as BPM engine and had the solution to create dynamically branches of some fork-join, defined in process, depending on content of some collection variable from execution context. ie for each element in some collection(content of JBPM variable VARIABLES) separate execution branch is created and concrete branch will contain new variable VARIABLE with value of concrete element of collection provided.
Could you please suggest, how to achieve same/similar behaviour in Flowable/Activiti/Camunda?
For example:
<start-state name=“Start state”>
<transition to=“For each variable start subprocess” name=“For each variable start subprocess”>
<action class=“some.package.name.ParallelForEachAction”>
<currentKeyVariableName>VARIABLE</currentKeyVariableName>
<forEachCollectionExpression>#{VARIABLES}</forEachCollectionExpression>
<signalChildrenAsynchronously>true</signalChildrenAsynchronously>
</action>
</transition>
</start-state>

<state name=“For each variable start subprocess”>
<transition to=“Subprocess execution”/>
</state>

<process-state name=“Subprocess execution”>
<sub-process name=“Subprocess” binding=“late”/>
<variable access=“read” name=“VARIABLE” mapped-name=“VARIABLE”/>
<variable access=“write” name=“OUTPUT_VARIABLE” mapped-name=“OUTPUT_VARIABLE”/>
<transition to=“joinAfterSubprocess”/>
</process-state>

<join name=“joinAfterSubprocess”>
<transition to=“end-state”/>
</join>

Found following:
https://flowable.org/docs/userguide/index.html#bpmnMultiInstance
Probably that is the answer…

Yes, multi-instance activities give you what you’re looking for, it sounds. There’s a nice combination you can do with the HTTP/REST task that can put a JSON response into a process variable that can then be used as a collection in a multi-instance subprocess etc. So, make a microservice call and then execute processes for each item in the response.

Cheers
Paul.

Ended up with following:
<process id=“foreachparallelprocess” name=“Process with Foreach Parallel” isExecutable=“true”>

<startEvent id=“start-event”/>
<sequenceFlow sourceRef=“start-event” targetRef=“parallelTask”/>

<scriptTask id=“parallelTask” name=“ParallelTask” scriptFormat=“javascript”>
<multiInstanceLoopCharacteristics isSequential=“false” flowable:collection=“COLLECTION” flowable:elementVariable=“ELEMENT”/>
<script>
execution.setVariable(“VARIABLE” + execution.getVariable(“ELEMENT”).toString(), true);
</script>
</scriptTask>

<sequenceFlow sourceRef=“parallelTask” targetRef=“afterJoinTask”/>

<scriptTask id=“afterJoinTask” name=“afterJoinTask” scriptFormat=“javascript”>
<script>
execution.setVariable(“afterJoin”, true);
</script>
</scriptTask>

<sequenceFlow sourceRef=“afterJoinTask” targetRef=“end-event”/>

<endEvent id=“end-event”/>
</process>