Repository navigation
5.5.1.4. Implicit Fork and Join
Stateflows Activity nodes can reuse tokens across outgoing flows or wait for input from multiple incoming flows without explicit Fork and Join Nodes. These are node activation options, not additional visible nodes. Prefer explicit nodes when the branching or synchronization should be clear in the UML graph.
flowchart LR
left(Produce A) --> join(Action with implicit join)
right(Produce B) --> join
join --> fork(Action with implicit fork)
fork --> one(Consumer 1)
fork --> two(Consumer 2)
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.
.AddInitial(initial => initial
.AddControlFlow("ProduceA")
.AddControlFlow("ProduceB"))
.AddAction(
"ProduceA",
async c => c.Output(10),
node => node.AddFlow<int>("Combine"))
.AddAction(
"ProduceB",
async c => c.Output(20),
node => node.AddFlow<int>("Combine"))
.AddAction(
"Combine",
async c => c.Output(c.GetTokensOfType<int>().Sum()),
node => node
.AddFlow<int>("WriteAudit")
.AddFlow<int>("UpdateDashboard"))
.AddAction("WriteAudit", async c =>
await audit.WriteAsync(c.GetTokensOfType<int>().Single(), c.CancellationToken))
.AddAction("UpdateDashboard", async c =>
await dashboard.UpdateAsync(c.GetTokensOfType<int>().Single(), c.CancellationToken))Combine uses the Action Node defaults: its implicit join waits for both streams, and its implicit fork permits the emitted result to reach both consumers. To express a visible synchronization or fan-out point instead, insert explicit Join and Fork Nodes.
With NodeOptions.ImplicitJoin, a node waits until the required incoming flow streams are available before activating. Without it, an available incoming stream can activate the node. This is not identical to an explicit Join Node, which represents synchronization as a separate model element.
With NodeOptions.ImplicitFork, a token can remain available for multiple matching outgoing flows. Without it, a token consumed by a selected outgoing flow is removed from the source node's remaining output tokens. Use an explicit Fork Node when the graph should show a deliberate fan-out.
| Node kind | Default options |
|---|---|
| Action |
ImplicitJoin and ImplicitFork
|
| Decision | ImplicitJoin |
| Data Store | ImplicitFork |
| Other control nodes | None |
Builders exposing node options can remove defaults with NoImplicitJoin() or NoImplicitFork(), or set options directly with SetOptions(...). Options affect execution semantics: change them only when the graph requires different token handling. See Nodes, Flows, and Tokens.
Home page Support Code licensed under an MIT-style License. Documentation licensed under CC BY 4.0. © by Mikołaj Milewski, 2026