Repository navigation
Activity Iterative Activity Node
An Iterative Activity Node executes a nested Activity repeatedly over partitions of its incoming tokens. AddIterativeActivity<TToken>(..., chunkSize) selects tokens of type TToken, groups them into chunks, and runs the nested graph once per chunk. Other token types are also available inside each nested run.
flowchart LR
source(Load records) -->|Record tokens| iterate{{Iterative Activity}}
subgraph body["Nested Activity, once per chunk"]
input["Input boundary"] --> total(Calculate batch total)
total --> output["Output boundary"]
end
iterate -->|Batch totals| report(Report totals)
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.
.AddInitial(initial => initial.AddControlFlow("LoadRecords"))
.AddAction(
"LoadRecords",
async c => c.OutputRange(await records.LoadAsync(c.CancellationToken)),
node => node.AddFlow<Record>("Batch"))
.AddIterativeActivity<Record>("Batch", nested => nested
.AddInput(input => input.AddFlow<Record>("CalculateBatch"))
.AddInitial(initial => initial.AddControlFlow("CalculateBatch"))
.AddAction(
"CalculateBatch",
async c =>
{
var batchTotal = c.GetTokensOfType<Record>().Sum(record => record.Amount);
c.Output(batchTotal);
},
node => node.AddFlow<decimal, OutputNode>())
.AddOutput()
.AddFlow<decimal>("ReportBatch"),
chunkSize: 25)
.AddAction("ReportBatch", async c =>
await reports.AddBatchTotalsAsync(
c.GetTokensOfType<decimal>(), c.CancellationToken))An OutputNode and AddOutput() are required to collect values from each nested execution. Without an output declaration the nested computation can still perform side effects, but it returns no object tokens to the parent. A FinalNode inside the nested graph ends the iteration early; otherwise all chunks are processed. Iterations run sequentially, unlike the Parallel Activity Node, which runs chunks concurrently. Choose a chunk size appropriate to the amount of data each nested execution should process.
See also Structured Activity Node, Tokens, and Output Node.
Home page Support Code licensed under an MIT-style License. Documentation licensed under CC BY 4.0. © by Mikołaj Milewski, 2026
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