Pattern for parallel sub-workflow execution followed by wait-for-all loop
Ready for 3.0What this workflow does
This workflow has 14 nodes and runs manually, when you click “Execute workflow” (plus 1 other trigger). It uses only n8n's built-in nodes.
How it runs
Trigger: Manually, when you click “Execute workflow” (plus 1 other trigger).
- Simulate Multi-Item for Parallel Processing (Code): runs custom JavaScript code
- Respond to Webhook: sends the response back to the webhook caller
- Loop Over Items (Loop Over Items (Split in Batches)): loops over the items in batches
- Wait: pauses before continuing
- Initialize finishedSet (Edit Fields (Set)): sets 1 field: finishedSet
- Start Sub-Workflow via Webhook (HTTP Request): calls an HTTP API (POST)
- Call Resume on Parent Workflow (HTTP Request): calls an HTTP API (POST)
- If: checks a condition and branches into true / false
- Webhook Callback Wait (Wait): pauses until webhook
- Update finishedSet (Code): runs custom JavaScript code
…plus 1 more step. See the full node list below.
Before you upgrade to n8n 3.0
Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.
- Code node: the task timeout drops from 300s to 60s. Test with a realistic data volume.
Nodes used (10)
- Manual Trigger
n8n-nodes-base.manualTrigger - Loop Over Items (Split in Batches)
n8n-nodes-base.splitInBatches - Wait
n8n-nodes-base.wait - Code
n8n-nodes-base.code - Edit Fields (Set)
n8n-nodes-base.set - If
n8n-nodes-base.if - HTTP Request
n8n-nodes-base.httpRequest - Respond to Webhook
n8n-nodes-base.respondToWebhook - No Operation, do nothing
n8n-nodes-base.noOp - Webhook
n8n-nodes-base.webhook
From the author
What this workflow does This (set of) workflow(s) shows how to start multiple sub-workflows, asynchronously, in parallel, and then wait for all of them to complete. Normally sub-workflows would need to be run synchronously, in series, or, if they are executed…