Skip to main content
Allows workflows to iterate over a collection of items, executing a defined set of subtasks for each item in the collection. This task type is instrumental in handling scenarios such as batch processing, data transformation, and repetitive operations across datasets.

Properties

for.each
string
default:"item"
The name of the variable used to store the current item being enumerated.
for.in
string
required
A runtime expression used to get the collection to enumerate.
for.at
string
default:"index"
The name of the variable used to store the index of the current item being enumerated.
while
string
A runtime expression that represents the condition, if any, that must be met for the iteration to continue.
do
map[string, task]
required
The task(s) to perform for each item in the collection.

Example

document:
  dsl: '1.0.3'
  namespace: test
  name: for-example
  version: '0.1.0'
do:
  - checkup:
      for:
        each: pet
        in: .pets
        at: index
      while: .vet != null
      do:
        - waitForCheckup:
            listen:
              to:
                one:
                  with:
                    type: com.fake.petclinic.pets.checkup.completed.v2
            output:
              as: '.pets + [{ "id": $pet.id }]'

Build docs developers (and LLMs) love