Interface IFlowOrchestrator
- Namespace
- FlowOrchestrator.Core.Execution
- Assembly
- FlowOrchestrator.Core.dll
Runtime-neutral entry point for the FlowOrchestrator execution engine. Implemented by FlowOrchestrator.Core.Execution.FlowOrchestratorEngine; consumed by runtime adapters (Hangfire, in-memory pump, queue consumer) that handle the actual job dispatch.
public interface IFlowOrchestrator
Methods
RetryStepAsync(Guid, Guid, string, CancellationToken)
Resets a Failed step and dispatches a fresh attempt of it through the runtime. Used by the
dashboard Retry button.
ValueTask<object?> RetryStepAsync(Guid flowId, Guid runId, string stepKey, CancellationToken ct = default)
Parameters
flowIdGuidThe flow that owns the run.
runIdGuidThe run containing the step to retry.
stepKeystringThe key of the step to retry.
ctCancellationTokenCancels the request before the step is reset; once the reset is durable it is ignored, so an abandoned caller cannot leave the step reset but never dispatched.
Returns
- ValueTask<object>
A StepRetryResult: Accepted when the step was reset and dispatched, NotFailed when it is not
Failed, and Conflict when a concurrent retry reset it first.
Remarks
Since 2.0 the step runs asynchronously on the runtime, not on the caller's thread, and only a
Failed step can be retried. The reset is a compare-and-swap, so of two concurrent retries
exactly one is accepted.
Exceptions
- InvalidOperationException
The flow is not registered, or the step is not in its manifest.
RunStepAsync(IExecutionContext, IFlowDefinition, IStepInstance, CancellationToken)
Executes one step: runs the handler, persists the result, and dispatches the next ready steps. Called by the runtime adapter when a dispatched step job fires.
ValueTask<object?> RunStepAsync(IExecutionContext context, IFlowDefinition flow, IStepInstance step, CancellationToken ct = default)
Parameters
contextIExecutionContextThe ambient execution context carrying RunId and trigger data.
flowIFlowDefinitionThe flow definition that owns this step.
stepIStepInstanceThe step instance with resolved inputs.
ctCancellationTokenCancellation token.
Returns
TriggerAsync(ITriggerContext, CancellationToken)
Starts a new flow run: persists trigger data, registers idempotency key if present, creates the run record, and dispatches entry steps.
ValueTask<object?> TriggerAsync(ITriggerContext context, CancellationToken ct = default)
Parameters
contextITriggerContextTrigger context populated by the caller. JobId should be set to the runtime job or message ID before calling, if available.
ctCancellationTokenCancellation token.
Returns
TriggerByScheduleAsync(Guid, string, string?, CancellationToken)
Resolves the flow by flowId and starts a run via its cron trigger.
Used by recurring job runtimes (Hangfire recurring jobs, cron daemon, etc.).
ValueTask<object?> TriggerByScheduleAsync(Guid flowId, string triggerKey, string? jobId = null, CancellationToken ct = default)
Parameters
flowIdGuidThe flow to trigger.
triggerKeystringThe manifest trigger key (e.g.
"schedule").jobIdstringOptional runtime job/message ID to correlate with the run record.
ctCancellationTokenCancellation token.