Skip to content

Activity Structured Activity Node

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

Structured Activity Node

A Structured Activity Node contains a nested Activity graph. It groups steps behind one node in the containing Activity and gives the nested graph its own Initial, Input, and optional Output nodes. This is the UML structured activity node pattern; it does not create a separately addressed Activity behavior instance.

flowchart LR
    outer(Parent Activity)
    outer --> input["Input boundary"]
    subgraph nested["Structured Activity"]
        input --> normalize(Normalize)
        normalize --> output["Output boundary"]
    end
    output --> next(Parent continuation)
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. Input/Output boxes name Stateflows boundary APIs, not UML final nodes or a claim that UML uses these box labels. Mermaid does not model pins, activity parameters, or expansion regions natively.

Passing data through the boundary

The parent sends tokens to the structured node through its incoming object flow. Inside the node, AddInput routes selected input types to nested nodes. To return a value, connect a nested producer to OutputNode, declare AddOutput(), and connect the structured node's outgoing object flow to a parent node.

.AddInitial(initial => initial.AddControlFlow("ReadAmount"))
.AddAction(
    "ReadAmount",
    async c => c.Output(125m),
    node => node.AddFlow<decimal>("Normalize"))
.AddStructuredActivity("Normalize", nested => nested
    .AddInput(input => input.AddFlow<decimal>("Round"))
    .AddInitial(initial => initial.AddControlFlow("Round"))
    .AddAction(
        "Round",
        async c => c.Output(decimal.Round(
            c.GetTokensOfType<decimal>().Single(), 2)),
        node => node.AddFlow<decimal, OutputNode>())
    .AddOutput()
    .AddFlow<decimal>("RecordAmount"))
.AddAction("RecordAmount", async c =>
    await ledger.RecordAsync(
        c.GetTokensOfType<decimal>().Single(), c.CancellationToken))

The nested definition also supports actions, control nodes, event actions, and further structured nodes. Its configuration and active nodes are scoped under the containing node. A structured node can remain active across event processing; use Behavioral Groups when referring to state-machine-embedded behaviors, which are separate behavior instances rather than nested Activity nodes.

See Input Node, Output Node, and Parallel Activity Node.

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