Skip to content

Activity Time Event Action Node

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

Time Event Action Node

A Time Event Action Node activates when its typed TimeEvent becomes due. It is an event-triggered action: Stateflows schedules the event according to its trigger time, then executes the node and follows its outgoing flows.

Define a time event

Derive an event from TimeEvent and calculate its UTC trigger time from the supplied start instant:

public sealed class ReservationExpired : TimeEvent
{
    protected override DateTime GetTriggerTime(DateTime startedAt)
        => startedAt.AddMinutes(15);
}

Register the corresponding node with AddTimeEventAction<TTimeEvent>:

.AddInitial(node => node.AddControlFlow("ReservationTimeout"))
.AddTimeEventAction<ReservationExpired>(
    "ReservationTimeout",
    async c => await reservations.ExpireAsync(
        reservationId, c.CancellationToken),
    node => node.AddControlFlow<FinalNode>())
.AddFinal()

The time event is associated with an active Activity node, not a periodic scan of arbitrary nodes. Give the node an outgoing flow when the Activity should continue after the timeout. The runtime hosting the behavior is responsible for delivering scheduled time events; Orleans hosting uses Orleans reminders. See Accept Event Action Node, Final Node, and Orleans Runtime.

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