Table of Contents

Interface IStepDispatcher

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

Bridges the core engine to the runtime that physically invokes RunStepAsync(IExecutionContext, IFlowDefinition, IStepInstance, CancellationToken) — Hangfire today, a queue consumer or in-memory channel tomorrow — without the engine knowing which one is active.

public interface IStepDispatcher

Remarks

Implementations must guarantee that all arguments are serialisable by the backing runtime so that a different worker process can deserialise and re-enter the engine.

Methods

EnqueueStepAsync(IExecutionContext, IFlowDefinition, IStepInstance, CancellationToken)

Enqueues immediate execution of a step.

ValueTask<string?> EnqueueStepAsync(IExecutionContext context, IFlowDefinition flow, IStepInstance step, CancellationToken ct = default)

Parameters

context IExecutionContext

The current execution context carrying RunId, trigger data, and principal.

flow IFlowDefinition

The flow definition the step belongs to.

step IStepInstance

The step instance to execute.

ct CancellationToken

Cancellation token.

Returns

ValueTask<string>

An opaque runtime-specific job or message identifier, or null if the runtime does not produce one.

ScheduleStepAsync(IExecutionContext, IFlowDefinition, IStepInstance, TimeSpan, CancellationToken)

Schedules deferred execution of a step after delay has elapsed. Used for polling steps (Pending), backoff retries, and runAfter-with-delay scenarios.

ValueTask<string?> ScheduleStepAsync(IExecutionContext context, IFlowDefinition flow, IStepInstance step, TimeSpan delay, CancellationToken ct = default)

Parameters

context IExecutionContext

The current execution context.

flow IFlowDefinition

The flow definition the step belongs to.

step IStepInstance

The step instance to execute.

delay TimeSpan

How long to wait before the step is eligible to run.

ct CancellationToken

Cancellation token.

Returns

ValueTask<string>

An opaque runtime-specific job or message identifier.