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
contextIExecutionContextThe current execution context carrying RunId, trigger data, and principal.
flowIFlowDefinitionThe flow definition the step belongs to.
stepIStepInstanceThe step instance to execute.
ctCancellationTokenCancellation 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
contextIExecutionContextThe current execution context.
flowIFlowDefinitionThe flow definition the step belongs to.
stepIStepInstanceThe step instance to execute.
delayTimeSpanHow long to wait before the step is eligible to run.
ctCancellationTokenCancellation token.