Table of Contents

Class FlowSignalDispatcher

Namespace
FlowOrchestrator.Core.Execution
Assembly
FlowOrchestrator.Core.dll

Default implementation that delegates persistence to IFlowSignalStore and re-dispatch to IStepDispatcher.

public sealed class FlowSignalDispatcher : IFlowSignalDispatcher
Inheritance
FlowSignalDispatcher
Implements
Inherited Members

Remarks

The resume nudge is dispatched immediately (EnqueueStepAsync(IExecutionContext, IFlowDefinition, IStepInstance, CancellationToken)) whenever the parked step no longer holds an execution claim, and only falls back to a short delayed dispatch in the narrow window where it still does. This matters because runtimes route delayed work differently from immediate work: on Hangfire any non-zero delay becomes BackgroundJob.Schedule, which parks the job in the Scheduled set until the next DelayedJobScheduler tick (BackgroundJobServerOptions.SchedulePollingInterval, 15 seconds by default). Always delaying therefore turned a 500 ms intent into up to 15 seconds of observed resume latency.

Constructors

FlowSignalDispatcher(IFlowSignalStore, IFlowRunStore, IFlowRepository, IStepDispatcher, IOutputsRepository, FlowOrchestratorTelemetry?, IEnumerable<IFlowRunRuntimeStore>?, ILogger<FlowSignalDispatcher>?)

Initialises the dispatcher with its dependencies.

public FlowSignalDispatcher(IFlowSignalStore signalStore, IFlowRunStore runStore, IFlowRepository flowRepository, IStepDispatcher dispatcher, IOutputsRepository outputsRepository, FlowOrchestratorTelemetry? telemetry = null, IEnumerable<IFlowRunRuntimeStore>? runtimeStores = null, ILogger<FlowSignalDispatcher>? logger = null)

Parameters

signalStore IFlowSignalStore

Persistence for signal waiters and delivered payloads.

runStore IFlowRunStore

Used to resolve the run that owns the addressed waiter.

flowRepository IFlowRepository

Used to resolve the flow definition backing the run.

dispatcher IStepDispatcher

Runtime adapter that carries the resume nudge back to a worker.

outputsRepository IOutputsRepository

Supplies trigger data/headers for the rebuilt execution context.

telemetry FlowOrchestratorTelemetry

Optional — when omitted, signal-wait metrics are not emitted.

runtimeStores IEnumerable<IFlowRunRuntimeStore>

Registered runtime stores; the first is used, matching how FlowOrchestratorEngine selects its own store. Taking the sequence rather than a single service keeps the two in agreement when a consumer layers a decorator registration on top of the built-in one — a single-service resolution would bind to the LAST registration while the engine binds to the FIRST, and the dispatcher would then read claim state from a different store than the engine claims against.

logger ILogger<FlowSignalDispatcher>

Optional — when omitted, lost resume nudges are not reported anywhere.

Methods

DispatchAsync(Guid, string, string, CancellationToken)

Validates the run, persists the payload on the matching waiter, and nudges the engine to re-execute the parked step so it observes the delivered payload.

public ValueTask<SignalDeliveryResult> DispatchAsync(Guid runId, string signalName, string payloadJson, CancellationToken ct = default)

Parameters

runId Guid

The run whose WaitForSignal step should receive the signal.

signalName string

Logical signal name configured on the step's signalName input.

payloadJson string

Pre-serialised JSON payload supplied by the caller.

ct CancellationToken

Cancellation token.

Returns

ValueTask<SignalDeliveryResult>