Skip to content

Activity Fork Node

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

Fork Node

A Fork Node duplicates the offered control and object tokens onto multiple outgoing flows, enabling parallel paths in a UML Activity. Unlike a Decision Node, a Fork does not choose one guarded alternative.

flowchart LR
    create(Create shipment) --> fork[ ]:::bar
    fork -->|Shipment| label(Print label)
    fork -->|Shipment| notify(Notify customer)
    classDef bar fill:#000,stroke:#000
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. The black rectangle approximates a UML fork/join bar; its exact proportions depend on Mermaid rendering.

Definition

.AddAction(
    "CreateShipment",
    async c => c.Output(new Shipment("SHP-42")),
    node => node.AddFlow<Shipment, ForkNode>())
.AddFork(fork => fork
    .AddFlow<Shipment>("PrintLabel")
    .AddFlow<Shipment>("NotifyCustomer"))
.AddAction("PrintLabel", async c =>
    await labels.PrintAsync(c.GetTokensOfType<Shipment>().Single(), c.CancellationToken))
.AddAction("NotifyCustomer", async c =>
    await notifications.SendAsync(c.GetTokensOfType<Shipment>().Single(), c.CancellationToken))

Both outgoing branches receive the forked token. A Fork Node has no joining behavior; use a Join Node to synchronize flows later. Actions also have implicit-fork behavior by default; an explicit Fork makes the branching point clear in the model. See Implicit Fork and Join.

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