Merge

Combine multiple branches into one

Overview

The Merge utility combines bundles from multiple incoming branches into a single output stream. It waits for all connected source nodes to complete before outputting, making it a synchronization point in your flow.

Merge supports two modes: Zip (combine by position) and Append(stack sequentially).

Configuration

Mode

Zip Mode

Combines bundles by position/index. Output count equals the maximum bundle count across all branches. Useful when branches have corresponding items.

Append Mode

Stacks all bundles sequentially. Output count equals the sum of all branch bundle counts. Useful when collecting all items from different sources.

Field Mapping (Optional)

Define how to structure the output by mapping fields from source branches. Each field can pull data from different source nodes using templates.

How It Works

Zip Mode Example:

Branch A: [{a:1}, {a:2}]
Branch B: [{b:10}, {b:20}]

Output (2 bundles - max count):
  Bundle 1: combines A[0] and B[0]
  Bundle 2: combines A[1] and B[1]

Append Mode Example:

Branch A: [{a:1}, {a:2}]
Branch B: [{b:10}]

Output (3 bundles - sum of counts):
  Bundle 1: {a:1}
  Bundle 2: {a:2}
  Bundle 3: {b:10}

Synchronization

Important: Merge waits for ALL incoming branches to complete before executing. If a branch hasn't finished yet, Merge will output a waiting status and retry when more data arrives.

Examples

Example 1: After IF Condition

Merge results after conditional processing:

                    ┌── True ──▶ [Process A] ──┐
[IF: amount > 100] ─┤                          ├──▶ [Merge] ──▶ [Send Email]
                    └── False ─▶ [Process B] ──┘

Use Append mode to collect whichever branch executed.

Example 2: Parallel API Calls

Combine results from multiple API sources:

[Trigger] ──┬── [API 1: Users] ────┐
            │                       ├──▶ [Merge: Zip] ──▶ [Combine]
            └── [API 2: Profiles] ──┘

Use Zip mode when APIs return corresponding items (user 1 with profile 1, etc.).

Example 3: Collect All Items

Gather items from multiple sources:

[Trigger] ──┬── [Database Query] ───┐
            ├── [API Call] ─────────┼──▶ [Merge: Append] ──▶ [Process All]
            └── [File Read] ────────┘

Use Append mode to stack all items from all sources.

Tips

Tip: Use field mapping to create a clean output structure by selecting specific fields from each source branch.

Tip: Merge works with any number of incoming connections. You can merge 2, 3, or more branches.

Note: In Zip mode, if branches have different bundle counts, some positions may have null values from shorter branches.

Merge Utility - Flows Guide - Serenities