AWS Step Function Map equivalent in BPMN

I have a dynamically sized list of objects in BPMN, and would like to iterate through them. For each item in the map, I would like to create a parallel external task, which would in turn move on to the next step in the flow after each task is done. I’m familiar with parallel gateways, although I’m unsure how I would create a parallel lane for each item in the list.

In AWS Step Functions, this could be accomplished via the map function (https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-map-state.html), but I’m unable to find the equivalent in BPMN.

Welcome to the Camunda Forum!

You’re looking for a subprocess executed per item in the list.

Something similar to

Each “item” in the “list” will create a parallel instance of “Process Item on List” which can then be run in the context of the individual item. “Do the work” will then be run on that item, and all the activities for that item will happen. You can have more workflow within the “Process Item on List” including gateways, Call Activites, etc.

1 Like

Thank you so much for your reply! It’s very helpful. Question for you: if there were a task after “Process Item on List” (let’s call it “Finalize”), would it wait for all “Process Item On List” executions to complete before it is executed? I wouldn’t want “Finalize” to be invoked before each instance of “Process Item on List” was completed.

Yes, if you put the “Finalize” task after the “Process Item on List” then it will wait until all the Items on the list have been processed before doing the finalize.

If you put it after “Do the work”, it would happen for each item it processed

2 Likes

Great, thank you for responding! I’ll take a look at this!

It would look something like this.

In BPMN, you can use a “Multi-Instance” Task to iterate through a list of objects and perform parallel execution for each item in the list. The Multi-Instance marker (three parallel lines) can be used to signify that the task will be instantiated multiple times based on the collection you want to iterate through. This allows you to dynamically size the number of parallel tasks based on the size of your list. You can specify the input and output collections, and the task will process each element of the collection in parallel, similar to the Map state in AWS Step Functions.

To proceed to the next step in the flow after each task is done, you can use a “Join” parallel gateway that will synchronize the parallel tasks back into a single flow.

This way, you can effectively handle dynamic lists and execute tasks in parallel, similar to the Map function in AWS Step Functions.