Skip to content

Activity Merge Node

Mikołaj Milewski edited this page Oct 27, 2026 · 1 revision

Merge Node

A Merge Node brings alternative incoming flows back to one outgoing path. It does not synchronize the alternatives: an arrival on any input can continue. In UML it is drawn as a diamond, like a Decision Node, but its edge direction is converging rather than branching.

flowchart LR
    choose{Decision}
    choose -->|approved| card(Card payment)
    choose -->|else| transfer(Bank transfer)
    card --> merge{Merge}
    transfer --> merge
    merge --> receipt(Send receipt)
Loading

Mermaid approximation: this diagram shows the model's routing, not a complete UML Activity notation. Rounded boxes represent actions; edge labels identify token types or guards. Mermaid does not provide native Activity node semantics.

Definition

.AddDecision<Payment>(decision => decision
    .AddFlow("CardPayment", flow => flow.AddGuard(async c => c.Token.Method == "card"))
    .AddElseFlow("BankTransfer"))
.AddAction(
    "CardPayment",
    async c => c.Output(await payments.ChargeCardAsync(
        c.GetTokensOfType<Payment>().Single(), c.CancellationToken)),
    node => node.AddFlow<Receipt, MergeNode>())
.AddAction(
    "BankTransfer",
    async c => c.Output(await payments.TransferAsync(
        c.GetTokensOfType<Payment>().Single(), c.CancellationToken)),
    node => node.AddFlow<Receipt, MergeNode>())
.AddMerge(merge => merge.AddFlow<Receipt>("SendReceipt"))
.AddAction("SendReceipt", async c =>
    await receipts.SendAsync(c.GetTokensOfType<Receipt>().Single(), c.CancellationToken))

The Merge Node forwards an arriving alternative; it does not wait for all its inputs. The default options for control nodes do not add implicit joining. Use a Join Node when multiple concurrent branches must all arrive first.

Overview
Installation
Runtimes
   Orleans runtime
Concepts
   Events and Structural Events
   Messaging Patterns
   Validation
   Scheduling
   Observability
Behaviors
   Behavior Values
   Dependency Injection
   Behavioral Groups
   State Machines
       Concepts
           State Identity
           In-State Event Deferrals
           Evaluation of Transitions
           Exception Handling
       Building blocks
           Regions
           States
               State
               Composite State
               Orthogonal State
               Final State
           Pseudostates
               Choice
               Junction
               Fork
               Join
               History
           Transitions
               Transition
               Default Transition
               Internal Transition
   Activities
       Concepts
           Exception Handling
           Implicit Fork and Join
           Tokens
       Building blocks
           Nodes
               Action Node
               Decision Node
               Merge Node
               Initial Node
               Final Node
               Input Node
               Output Node
               Fork Node
               Join Node
               Accept Event Action Node
               Send Event Action Node
               Publish Event Action Node
               Time Event Action Node
               Data Store Node
               Structured Activity Node
               Iterative Activity Node
               Parallel Activity Node
           Flows
               Data Flow
               Control Flow
   Actions
   Entities
       Fields
       Mutations
       Projections
Extensions
   ClearScript
   FluentValidation
   JSON definitions
   Minimal APIs
   OneOf
   OpenTelemetry
   PlantUML
   Scheduling

Clone this wiki locally