Class ForEachItem

java.lang.Object
io.kestra.core.models.tasks.Task
io.kestra.core.tasks.flows.ForEachItem
All Implemented Interfaces:
ExecutableTask<ForEachItem.Output>

@Plugin(examples=@Example(title="Execute a subflow for each batch of items. The subflow `orders` is called from the parent flow `orders_parallel` using the `ForEachItem` task in order to start one subflow execution for each batch of items.\n```yaml\nid: orders\nnamespace: prod\n\ninputs:\n - name: order\n type: STRING\n\ntasks:\n - id: read_file\n type: io.kestra.plugin.scripts.shell.Commands\n runner: PROCESS\n commands:\n - cat \"{{ inputs.order }}\"\n\n - id: read_file_content\n type: io.kestra.core.tasks.log.Log\n message: \"{{ read(inputs.order) }}\"\n```\n",full=true,code="id: orders_parallel\nnamespace: prod\n\ntasks:\n - id: extract\n type: io.kestra.plugin.jdbc.duckdb.Query\n sql: |\n INSTALL httpfs;\n LOAD httpfs;\n SELECT *\n FROM read_csv_auto(\'https://raw.githubusercontent.com/kestra-io/datasets/main/csv/orders.csv\', header=True);\n store: true\n\n - id: each\n type: io.kestra.core.tasks.flows.ForEachItem\n items: \"{{ outputs.extract.uri }}\"\n batch:\n rows: 1\n namespace: prod\n flowId: orders\n wait: true # wait for the subflow execution\n transmitFailed: true # fail the task run if the subflow execution fails\n inputs:\n order: \"{{ taskrun.items }}\" # special variable that contains the items of the batch")) public class ForEachItem extends Task implements ExecutableTask<ForEachItem.Output>