Orchestrate Parallel Sub-Workflows with Pseudo-Synchronous Control
detail.loadingPreview
This n8n workflow pattern enables you to trigger multiple sub-workflows concurrently and effectively wait for all of them to complete before proceeding. It leverages webhooks for asynchronous communication and a clever checking mechanism to achieve pseudo-synchronous control.
About This Workflow
This powerful n8n workflow pattern empowers you to break down complex tasks into smaller, manageable sub-workflows that can be executed in parallel. The parent workflow initiates these sub-tasks, then uses a webhook listener and a set-based tracking mechanism to monitor their completion. Once all sub-workflows have reported back, the parent workflow can seamlessly continue, enabling efficient parallel processing and a unified control flow. This is ideal for scenarios requiring distributed computation or the orchestration of independent, time-consuming operations.
Key Features
- Asynchronous Sub-Workflow Initiation: Launch multiple instances of a sub-workflow concurrently.
- Webhook-Based Callbacks: Sub-workflows signal their completion via webhooks.
- Pseudo-Synchronous Control: The main workflow waits and effectively monitors the completion of all parallel tasks.
- Dynamic Progress Tracking: A
finishedSetarray intelligently tracks completed sub-tasks. - Robust Error Handling: Built-in retry mechanisms for reliable communication.
How To Use
- Configure the Sub-Workflow: Create a separate n8n workflow designed to be triggered via webhook. This sub-workflow should be able to receive a
requestItemIdand must include aWaitnode (e.g.,e92865b0-b3e9-4195-ae16-5c199875a04b) and anhttpRequestnode (e.g.,710456c8-394d-4c45-8d8e-16e0a4095dc3) to call back to the parent workflow with thefinishedItemIdand the parent'scallbackurl. - Set up the Parent Workflow:
- Start with a
manualTrigger(e.g.,0d911b91-bb9a-4177-8cd5-12ddddf1bc61) or any other suitable trigger. - Use a
codenode (e.g.,105d8f64-8ade-4e02-8722-587a35f2b046) to generate an array of items to be processed in parallel (each with a uniquerequestId). - Use a
splitInBatchesnode (e.g.,d13f78f7-4093-435f-8b38-722f4a5c7a1f) to iterate over these items. - Inside the loop, use an
httpRequestnode (e.g.,20d16393-8573-4cc1-adc0-034f0f1def70) to trigger your configured sub-workflow via its webhook URL. Crucially, pass the$execution.resumeUrlas acallbackurlheader. - Initialize an empty array for
finishedSetusing asetnode (e.g.,09f1cf3f-9e32-43f2-9e57-d7a33970dac4) withexecuteOnce: true. - Use an
ifnode (e.g.,c5f72fa0-693e-4134-910f-8fd0767861d1) to check if thefinishedSet.lengthis equal to the total number of parallel items. - If the condition is met, use a
webhookId'swaitnode (e.g.,97d26220-a85f-4c40-b97c-b36f2d235776) to receive the callback from the sub-workflows. - A
codenode (e.g.,ee02d5cb-8151-4b24-a630-77a677b1434a) updates thefinishedSetwith thefinishedItemIdfrom the webhook. - After the loop and condition check, you can add further nodes to continue your workflow now that all sub-tasks are complete.
- Start with a
Apps Used
Workflow JSON
{
"id": "c5e1fb27-9bfe-4b00-81c6-6bb3bffbe5f0",
"name": "Orchestrate Parallel Sub-Workflows with Pseudo-Synchronous Control",
"nodes": 9,
"category": "DevOps",
"status": "active",
"version": "1.0.0"
}Note: This is a sample preview. The full workflow JSON contains node configurations, credentials placeholders, and execution logic.
Get This Workflow
ID: c5e1fb27-9bfe...
About the Author
AI_Workflow_Bot
LLM Specialist
Building complex chains with OpenAI, Claude, and LangChain.
Statistics
Related Workflows
Discover more workflows you might like
Automated PR Merged QA Notifications
Streamline your QA process with this automated workflow that notifies your team upon successful Pull Request merges. Leverage AI and vector stores to enrich notifications and ensure seamless integration into your development pipeline.
Visualize Your n8n Workflows: Interactive Dashboard with Mermaid.js
Gain unparalleled visibility into your n8n automation landscape. This workflow transforms your n8n instance into a dynamic, interactive dashboard, leveraging Mermaid.js to visualize all your workflows in one accessible place.
Effortless Bug Reporting: Slack Slash Command to Linear Issue
Streamline your bug reporting process by instantly creating Linear issues directly from Slack using a simple slash command. This workflow enhances team collaboration by providing immediate feedback and a structured approach to logging defects, saving valuable time for development and QA teams.