Skip to content

5.5.2.1.13. Time Event Action Node

Mikołaj Milewski edited this page Nov 12, 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 uses reminders for persisted schedules.

During an Orleans Activity stream, the live session can deliver a due time event before the next checkpoint. Time-event firings remain transactional sources; downstream consumers that mix their output with streamed input become streamed. Future timers do not keep an otherwise idle stream busy. New schedules created during a busy period are volatile until the next checkpoint/quiescence persistence, so crash recovery is limited to the persisted schedule.

See Accept Event Action Node, Final Node, and Orleans Runtime.

Clone this wiki locally