MergeMultiple
Description
Section titled “Description”The mergeMultiple module is a convergence node that waits for and combines data from multiple parallel workflow branches. When a flow is split into several branches (for example, via a Decision or Switch), mergeMultiple waits until all predecessor branches have completed their execution before continuing. It uses the database (merge_states table) to store partial data from each branch and verify when all have been received. It supports nested iterations with unique merge keys per level and group. It includes a configurable timeout mechanism (5 minutes by default) to avoid deadlocks if a branch never arrives, and protection against ghost re-executions.
Configuration
Section titled “Configuration”Parameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
| (no user-configurable parameters) | - | - | This module is automatically configured based on the workflow connections. Predecessor modules are detected automatically. |
Output
Section titled “Output”{ "nextModule": "siguiente_modulo", "data": { "merged": { "rama_A": { "datos": "de rama A" }, "rama_B": { "datos": "de rama B" } }, "array": [ { "source": "rama_A", "data": { "datos": "de rama A" } }, { "source": "rama_B", "data": { "datos": "de rama B" } } ], "items": [], "sources": ["rama_A", "rama_B"], "missingSources": [], "count": 2, "totalItems": 0, "status": "complete", "timedOut": false }}Usage Example
Section titled “Usage Example”Basic case
Section titled “Basic case”{ "label": "mergeMultiple"}- Predecessor modules are automatically detected from the workflow connections, or can be manually specified via
config.predecessors. - Data from each branch is stored in the
merge_statesdatabase table. - The unique merge key is constructed as:
{workflowId}_{moduleName}_{mergeGroupKey}_{mergeLevel}. - Configurable timeout with
config.mergeTimeout(in milliseconds). Default: 300000ms (5 minutes). If it expires, it continues with available data and markstimedOut: true. - When the Decision node skips a branch, it automatically inserts a “skipped” record to unblock this merge.
- Protection against ghost re-executions: if the merge has already been completed for the same key, it ignores the duplicate execution.
- The output includes multiple formats:
merged(object by source),array(array of objects),items(unified items from all branches). - Automatically creates the
merge_statestable if it does not exist. - If predecessors are missing, it returns a
pendingstatus with the list of missing modules and progress.
Related Nodes
Section titled “Related Nodes”- Decision - splits the flow into two true/false branches
- Switch - splits the flow into multiple routes
- Router - routes by field value
- MergeIterator - merge for iterations
- MergeResults - advanced merge with memory