Skip to content

Activity Data Store Node

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

Data Store Node

A Data Store Node retains object tokens within the Activity instance and offers the stored tokens on its outgoing object flows when those flows are activated. It represents a UML data store, not a database or external persistence service; use application services for durable storage.

flowchart LR
    start@{ shape: circle, label: " " }
    start --> source(Receive measurement)
    source -->|Measurement| store["&lt;&lt;datastore&gt;&gt;<br/>Measurements"]
    tick(Accept inspection event) --> inspect(Inspect stored measurements)
    store -->|Stored measurements| inspect
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 stereotyped object node represents a UML data store; it is not a database cylinder.

Definition

.AddInitial(initial => initial.AddControlFlow("ReadMeasurement"))
.AddAction(
    "ReadMeasurement",
    async c => c.Output(await sensors.ReadAsync(c.CancellationToken)),
    node => node.AddFlow<Measurement>("Measurements"))
.AddDataStore("Measurements", store => store
    .AddFlow<Measurement>("Inspect"))
.AddAcceptEventAction<InspectMeasurements>(
    "InspectTrigger",
    async c => { },
    node => node.AddControlFlow("Inspect"))
.AddAction("Inspect", async c =>
{
    var stored = c.GetTokensOfType<Measurement>().ToArray();
    await reports.RecordInspectionAsync(stored, c.CancellationToken);
})

The store holds the values passed into it; each activation of its outgoing path can make the stored set available again. Its contents are part of the Activity's execution state, not automatically persisted to an external system. The default Data Store Node option enables implicit fork behavior so stored values can be made available to outgoing flows. See Tokens, Accept Event Action Node, and Implicit Fork and Join.

public sealed record Measurement(string SensorId, decimal Value);
public sealed record InspectMeasurements;

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