Repository navigation
5.5.2.1.2. Decision Node
A Decision Node selects outgoing flows according to guards. A token decision evaluates object-flow guards for each token; a control decision evaluates control-flow guards without application data. Both are UML decision nodes, drawn as diamonds. A decision routes along eligible guarded flows; an else flow is the fallback when no guarded flow is selected.
flowchart LR
start((●)) --> price(Read price)
price -->|decimal| choose{Decision}
choose -->|token >= 100| review(Manual review)
choose -->|else| auto(Auto-approve)
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.
Specify the token type on AddDecision<TToken>. Each guard receives the candidate token as c.Token.
.AddAction(
"ReadPrice",
async c => c.Output(125m),
node => node.AddFlow<decimal, DecisionNode<decimal>>())
.AddDecision<decimal>(decision => decision
.AddFlow("ManualReview", flow => flow
.AddGuard(async c => c.Token >= 100m))
.AddElseFlow("AutoApprove"))
.AddAction("ManualReview", async c => await review.QueueAsync(c.CancellationToken))
.AddAction("AutoApprove", async c => await approval.ApproveAsync(c.CancellationToken))The decision forwards matching tokens through the selected object flows. It does not execute application action code itself. If flows need to change the token type, configure an outgoing-flow transformation.
Use AddControlDecision when the branch depends on state or another source rather than an incoming token:
.AddControlDecision(decision => decision
.AddFlow("Approved", flow => flow.AddGuard(async c =>
await c.Behavior.Values.GetOrDefaultAsync("approved", false)))
.AddElseFlow("Rejected"))The default Decision Node option includes ImplicitJoin; configure node options if a different incoming-flow activation rule is required. See Control Flow, Data Flow, and Implicit Fork and Join.
Home page Support Code licensed under an MIT-style License. Documentation licensed under CC BY 4.0. © by Mikołaj Milewski, 2026