Table of Contents

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

flowId Guid

The flow that owns the run.

runId Guid

The run containing the step to retry.

stepKey string

The key of the step to retry.

ct CancellationToken

Cancels 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

context IExecutionContext

The ambient execution context carrying RunId and trigger data.

flow IFlowDefinition

The flow definition that owns this step.

step IStepInstance

The step instance with resolved inputs.

ct CancellationToken

Cancellation token.

Returns

ValueTask<object>

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

context ITriggerContext

Trigger context populated by the caller. JobId should be set to the runtime job or message ID before calling, if available.

ct CancellationToken

Cancellation token.

Returns

ValueTask<object>

An anonymous object with runId (Guid) and duplicate (bool).

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

flowId Guid

The flow to trigger.

triggerKey string

The manifest trigger key (e.g. "schedule").

jobId string

Optional runtime job/message ID to correlate with the run record.

ct CancellationToken

Cancellation token.

Returns

ValueTask<object>