Configuration Reference
Complete reference for all options available on FlowOrchestratorBuilder and FlowDashboardOptions.
services.AddFlowOrchestrator(options => ...) ships in FlowOrchestrator.Core (namespace
Microsoft.Extensions.DependencyInjection, so no using is needed). Storage backends and runtimes
are extension methods on the options builder, each from its own package.
FlowOrchestratorBuilder
Storage
| Method | Description |
|---|---|
options.UseSqlServer(string connStr) |
Configure SQL Server persistence (Dapper) |
options.UsePostgreSql(string connStr) |
Configure PostgreSQL persistence (Npgsql) |
options.UseInMemory() |
Configure in-process storage (no persistence) |
Exactly one of these must be called. Omitting all three throws InvalidOperationException from AddFlowOrchestrator().
Flows
options.AddFlow<TFlow>()
Registers a flow class. TFlow must implement IFlowDefinition and have a public parameterless constructor. Call once per flow.
Runtime Adapter
Choose exactly one runtime adapter and select it inside the AddFlowOrchestrator() callback:
| Method | Package | Notes |
|---|---|---|
options.UseHangfire() |
FlowOrchestrator.Hangfire |
Steps run as Hangfire background jobs, cron triggers as Hangfire recurring jobs. Register Hangfire itself (AddHangfire / AddHangfireServer). |
options.UseInMemoryRuntime() |
FlowOrchestrator.InMemory |
Channel<T> dispatcher + PeriodicTimer cron, single process. |
options.UseAzureServiceBusRuntime(...) |
FlowOrchestrator.ServiceBus |
Topic + subscription-per-flow, self-perpetuating cron messages. |
Omitting the runtime throws InvalidOperationException from AddFlowOrchestrator() (1.x silently
registered a Hangfire dispatcher whose jobs could not run without UseHangfire()). A custom runtime
may instead register its own IStepDispatcher, IRecurringTriggerDispatcher and
IRecurringTriggerInspector; the effective-cron logic (dashboard pause / override, enabled flag) is
Core's RecurringTriggerSync and is shared by every runtime. Runtime registrations use TryAdd, so
the first runtime selected inside the callback wins.
Only when using the Hangfire runtime must Hangfire's own services (AddHangfire / AddHangfireServer) be registered before AddFlowOrchestrator():
Hangfire runtime (SQL Server or PostgreSQL persistence, distributed workers):
builder.Services.AddHangfire(...);
builder.Services.AddHangfireServer();
builder.Services.AddFlowOrchestrator(options =>
{
options.UseSqlServer(connStr); // or UsePostgreSql(...)
options.UseHangfire(); // FlowOrchestrator.Hangfire — wires the Hangfire runtime
options.AddFlow<MyFlow>();
});
InMemory runtime (no Hangfire at all — Channel<T> step dispatcher + PeriodicTimer cron):
builder.Services.AddFlowOrchestrator(options =>
{
options.UseInMemory(); // in-process storage
options.UseInMemoryRuntime(); // Channel<T> dispatcher + PeriodicTimer cron
options.AddFlow<MyFlow>(); // do NOT call UseHangfire() here
});
Note
The InMemory and Service Bus runtimes need no Hangfire package of any kind: since 2.0 AddFlowOrchestrator() lives in FlowOrchestrator.Core, so neither FlowOrchestrator.Hangfire nor Hangfire.Core is in their dependency graph. Cron parsing is handled by Cronos.
Tip
Storage and runtime are independent. UseInMemoryRuntime() works equally with UseSqlServer() or UsePostgreSql() if you want in-process step execution but durable run state.
Steps queued on the in-memory runtime live in the process (its channel and timers), so they stop with it;
the run state does not. On the next start, recovery re-enqueues every step that was dispatched but had not
started — including a Pending poll or a parked WaitForSignal whose delayed re-attempt was lost — and
the execution claim still runs each step once. Run one replica with this combination: a second replica
starting while the first is alive re-enqueues the first one's queued steps too. The claim keeps that safe
for ordinary steps, but a Pending poll then ends up polled by both replicas.
Azure Service Bus runtime (v1.22+ — cloud-native, multi-replica, multi-region):
builder.Services.AddFlowOrchestrator(options =>
{
options.UseSqlServer(connStr); // (or UsePostgreSql / UseInMemory)
options.UseAzureServiceBusRuntime(sb =>
{
sb.ConnectionString = builder.Configuration.GetConnectionString("ServiceBus")!;
sb.AutoCreateTopology = true; // creates topic + sub-per-flow at startup
// sb.StepTopicName = "flow-steps"; // defaults shown
// sb.CronQueueName = "flow-cron-triggers";
// sb.SubscriptionPrefix = "flow-";
// sb.MaxConcurrentCallsPerSubscription = 8;
});
options.AddFlow<MyFlow>();
});
The Service Bus runtime publishes step messages to a shared topic (flow-steps) with one
SQL-filtered subscription per registered flow (filter: FlowId = '{flowId}'), and runs cron
triggers as self-perpetuating scheduled messages on a dedicated queue (flow-cron-triggers).
The engine's Dispatch many, Execute once invariant (dispatch ledger + claim guard) makes
the at-least-once delivery model of Service Bus correct.
AutoCreateTopology = true (default) creates topic / queue / subscriptions via
ServiceBusAdministrationClient at startup — requires Manage rights on the connection
string. Set to false when topology is provisioned via IaC (Bicep / Terraform) and the
deploy identity has only Send / Listen rights.
ServiceBusRuntimeOptions
| Property | Type | Default | Description |
|---|---|---|---|
ConnectionString |
string |
— | Service Bus namespace connection string. Required; UseAzureServiceBusRuntime throws when empty. |
StepTopicName |
string |
"flow-steps" |
Topic that step-dispatch messages are published to; shared by all registered flows. |
CronQueueName |
string |
"flow-cron-triggers" |
Queue carrying self-perpetuating scheduled cron-trigger messages. |
SubscriptionPrefix |
string |
"flow-" |
Prefix for per-flow subscription names — the subscription becomes flow-{flowId}. |
MaxConcurrentCallsPerSubscription |
int |
8 |
Messages a single per-flow subscription processor handles concurrently. |
AutoCreateTopology |
bool |
true |
Create topic / queue / subscriptions at startup via ServiceBusAdministrationClient. Requires Manage rights. |
DuplicateDetectionWindow |
TimeSpan |
10 minutes | Duplicate-detection history window applied to the topic and cron queue when AutoCreateTopology is enabled. On the step topic every dispatch carries a unique MessageId ({runId}:{stepKey}:{nonce}), so the window only absorbs the SDK re-sending one message after a transient failure; on the cron queue the id is deterministic per fire time and chain ({flowId}:{triggerKey}:{fireAt}:{chainEpoch}), so it also collapses the same firing of the same schedule scheduled by several replicas, while a replacement schedule's first tick at the same instant is kept. |
MaxDeliveryCount |
int |
10 |
Delivery attempts before a message is dead-lettered. |
For local development, the included Aspire AppHost wires the official Microsoft Service Bus
emulator via AddAzureServiceBus("servicebus").RunAsEmulator() — see
FlowOrchestrator.AppHost/Program.cs
for the wiring; run dotnet run --project ./FlowOrchestrator.AppHost and the
flow-servicebus instance comes up on port 5104. Note: Aspire's emulator integration
cannot yet declare SQL filters on subscriptions (dotnet/aspire#11708),
so dev-mode topic broadcast is mitigated by an in-process dedup map in the SB processor —
production with AutoCreateTopology = true uses real filtered subscriptions and has no
broadcast overhead.
FlowSchedulerOptions
options.Scheduler.PersistOverrides = true;
| Property | Type | Default | Description |
|---|---|---|---|
PersistOverrides |
bool |
true |
Persist cron overrides written via dashboard or API to IFlowScheduleStateStore. When true, overrides survive process restarts; when false, the ephemeral in-memory store is used and the manifest cron expression is restored on each restart. |
FlowRunControlOptions
options.RunControl.DefaultRunTimeout = TimeSpan.FromMinutes(10);
options.RunControl.IdempotencyHeaderName = "Idempotency-Key";
options.RunControl.StepLeaseDuration = TimeSpan.FromSeconds(60); // the default
| Property | Type | Default | Description |
|---|---|---|---|
DefaultRunTimeout |
TimeSpan? |
null |
Global timeout for all runs. Runs exceeding this are marked TimedOut. Override per run by including runTimeoutSeconds in the trigger payload. null = no timeout. |
TimeoutEnforcementInterval |
TimeSpan? |
30 seconds | How often the periodic sweep proactively marks runs past TimeoutAtUtc as TimedOut, so a run whose step threw and left nothing scheduled does not sit Running forever. null or a non-positive value disables the sweep. |
StepLeaseDuration |
TimeSpan? |
60 seconds | How long a step's execution claim lives without renewal. The process running the step renews it, so a live handler is never taken over however long it runs; once its worker dies the lease expires, the next delivery of the step takes it over, and FlowStepLeaseHostedService redelivers it if the runtime does not. Keep it at least three times your store's worst round trip. null or non-positive turns leases off (1.x claims that never expire). |
StepLeaseRenewInterval |
TimeSpan |
20 seconds | How often a process renews the leases of the steps it is executing; capped at a third of StepLeaseDuration. |
OrphanedClaimTimeout |
TimeSpan? |
60 seconds | Age past which a claim with no step status row (a worker died between its claim and its start write) is released by startup recovery and the timeout sweep. Covers claims taken without a lease. null turns it off. |
UnsentDispatchTimeout |
TimeSpan? |
60 seconds | Age past which a dispatch-ledger row with no runtime job id (the send never returned) is re-delivered by FlowUnsentDispatchRecoveryHostedService. null turns it off. |
IdempotencyHeaderName |
string |
"Idempotency-Key" |
Header name checked on trigger requests. If present, the value is used as a deduplication key — a second trigger with the same key returns the existing run instead of creating a new one. |
IdempotencyReservationTimeout |
TimeSpan |
30 seconds | How old a key registration must be before a retry may take it over when its run never started work (no dispatched and no recorded step) — the trigger that registered it died before creating the run. A younger registration, or one whose run started, is still a duplicate. Must be positive; setting zero or less throws ArgumentOutOfRangeException. |
FlowObservabilityOptions
options.Observability.EnableOpenTelemetry = true;
| Property | Type | Default | Description |
|---|---|---|---|
EnableOpenTelemetry |
bool |
true |
Emit FlowOrchestratorTelemetry trace spans and metrics from the engine. The ActivitySource and Meter are always registered by AddFlowOrchestrator; this flag controls whether spans/counters are emitted. Use AddFlowOrchestratorInstrumentation() on your OTel pipeline to consume them. |
EnableEventPersistence was removed in 2.0: run events are no longer persisted, and the dashboard's run
timeline is derived from step attempts with no option to set. See
Migrating to 2.0.
FlowRetentionOptions
options.Retention.Enabled = true;
options.Retention.DataTtl = TimeSpan.FromDays(30);
options.Retention.SweepInterval = TimeSpan.FromHours(1);
| Property | Type | Default | Description |
|---|---|---|---|
Enabled |
bool |
false |
Start FlowRetentionHostedService. Disabled by default; opt in explicitly for production. |
DataTtl |
TimeSpan |
30 days | Age threshold — runs older than this are deleted on each sweep. |
SweepInterval |
TimeSpan |
1 hour | Interval between sweep passes. |
FlowDashboardOptions
builder.Services.AddFlowDashboard(options =>
{
options.Branding.Title = "My App Workflows";
options.Branding.Subtitle = "Production";
options.Branding.LogoUrl = "/logo.svg";
options.BasicAuth.Username = "admin";
options.BasicAuth.Password = "changeme";
});
Or via appsettings.json:
{
"FlowDashboard": {
"Branding": {
"Title": "My App Workflows",
"Subtitle": "Production",
"LogoUrl": "/logo.svg"
},
"BasicAuth": {
"Username": "admin",
"Password": "changeme"
}
}
}
| Property | Type | Default | Description |
|---|---|---|---|
Branding.Title |
string |
"FlowOrchestrator Dashboard" |
Displayed in the browser tab and navigation bar |
Branding.Subtitle |
string |
"Dashboard" |
Small label next to the title (environment, version, etc.) |
Branding.LogoUrl |
string? |
— | URL of a custom logo image shown in the navbar |
BasicAuth.Username |
string? |
— | Basic Auth username |
BasicAuth.Password |
string? |
— | Basic Auth password |
BasicAuth.Realm |
string |
"FlowOrchestrator Dashboard" |
WWW-Authenticate realm returned in 401 responses |
WebhookSecurity |
WebhookSecurityOptions |
(Enforce) | Enterprise webhook hardening pipeline. Configure via UseWebhookSecurity(b => …) — see below. |
Note
Basic Auth is enforced when both BasicAuth.Username and BasicAuth.Password are set. There is no separate Enabled flag — leaving either blank disables authentication.
WebhookSecurityOptions
Opt-in HMAC signature, replay, rate-limit, IP allow/deny, body cap, and DLQ
gates for the dashboard webhook receive endpoint. Since 2.0 the default is
EnforcementMode = Enforce: every gate a trigger declares rejects violating requests (a trigger that
declares none is unaffected). Off (the 1.x default) restores the v1.24 behaviour explicitly.
// Use the (IConfiguration, Action<FlowDashboardOptions>) overload so appsettings-bound
// Branding/BasicAuth are still applied — the delegate-only overload does NOT read
// configuration and therefore silently disables config-driven Basic Auth.
builder.Services.AddFlowDashboard(builder.Configuration, opts => opts.UseWebhookSecurity(sec =>
{
sec.UseEnforcementMode(WebhookEnforcementMode.Audit) // dry-run first
.UseMaxBodyBytes(1_048_576)
.UseReplayProtection(toleranceSeconds: 300)
.UseRateLimit(permitsPerSecond: 50, burstSize: 100, perIp: true)
.UseForwardedHeaders(depth: 1)
.AllowLegacySha1(); // GitHub legacy X-Hub-Signature opt-in
}));
// Storage backends (multi-replica) — replaces in-memory defaults:
builder.Services.AddFlowOrchestrator(options =>
{
options.UseSqlServer(sqlConn);
options.AddSqlServerWebhookHardening(sqlConn);
});
Warning
AddFlowDashboard has four overloads: (), (IConfiguration, sectionName), (Action<FlowDashboardOptions>), and (IConfiguration, Action<FlowDashboardOptions>, sectionName). The delegate-only overload does not bind configuration, so combining it with appsettings.json Basic Auth silently leaves the dashboard unauthenticated. Use the (IConfiguration, Action<FlowDashboardOptions>) overload whenever you need both bound settings and code-only configuration such as UseWebhookSecurity.
| Property | Type | Default | Description |
|---|---|---|---|
EnforcementMode |
WebhookEnforcementMode |
Enforce (1.x: Off) |
Off skips every gate. Audit runs gates + writes DLQ + emits metrics but always returns 202. Enforce rejects failing requests. |
AllowLegacySha1 |
bool |
false |
Allow HMAC-SHA1 signatures (legacy GitHub X-Hub-Signature). Off by default. |
MaxBodyBytes |
long |
1_048_576 |
Hard cap; oversized requests return 413 before JSON parsing. |
ReplayToleranceSeconds |
int |
0 |
Maximum allowed clock skew. 0 disables replay protection. |
DefaultTimestampHeader |
string? |
— | Global timestamp header default (e.g. "X-Webhook-Timestamp"). |
DefaultNonceHeader |
string? |
— | Global nonce / delivery-id header default. |
RateLimit.PermitsPerSecond |
double |
0 |
Sustained throughput. 0 disables rate limiting. |
RateLimit.BurstSize |
int? |
— | Optional burst capacity; defaults to PermitsPerSecond. |
RateLimit.PerIp |
bool |
false |
Key the limiter on flowId\|clientIp instead of flowId. |
ForwardedHeaderDepth |
int |
0 |
Number of trusted reverse proxies in front of the app; the client is the X-Forwarded-For entry that many positions from the right. 0 uses RemoteIpAddress directly. |
Manifest-level overrides are documented in Triggers — Enterprise hardening (v1.25).
For the full per-publisher cookbook (GitHub, Stripe, Slack, Shopify, …) see the dedicated Webhook hardening article.
Complete Examples
Hangfire Runtime (SQL Server)
builder.Services.AddHangfire(c => c
.SetDataCompatibilityLevel(CompatibilityLevel.Version_170)
.UseSimpleAssemblyNameTypeSerializer()
.UseRecommendedSerializerSettings()
.UseSqlServerStorage(connectionString));
builder.Services.AddHangfireServer();
builder.Services.AddFlowOrchestrator(options =>
{
options.UseSqlServer(connectionString);
options.UseHangfire();
// Scheduler
options.Scheduler.PersistOverrides = true;
// Run control
options.RunControl.DefaultRunTimeout = TimeSpan.FromMinutes(10);
options.RunControl.IdempotencyHeaderName = "Idempotency-Key";
// Observability
options.Observability.EnableOpenTelemetry = true;
// Retention
options.Retention.Enabled = true;
options.Retention.DataTtl = TimeSpan.FromDays(30);
options.Retention.SweepInterval = TimeSpan.FromHours(1);
// Flows
options.AddFlow<HelloWorldFlow>();
options.AddFlow<OrderFulfillmentFlow>();
options.AddFlow<OrderBatchFlow>();
});
// Step handlers
builder.Services.AddStepHandler<LogMessageHandler>("LogMessage");
builder.Services.AddStepHandler<QueryDatabaseHandler>("QueryDatabase");
// Dashboard
builder.Services.AddFlowDashboard(builder.Configuration);
var app = builder.Build();
app.UseHangfireDashboard("/hangfire");
app.MapFlowDashboard("/flows");
InMemory Runtime (Dev / Testing — no Hangfire package required)
builder.Services.AddFlowOrchestrator(options =>
{
options.UseInMemory();
options.UseInMemoryRuntime(); // Channel<T> dispatcher + PeriodicTimer cron
options.RunControl.IdempotencyHeaderName = "Idempotency-Key";
options.AddFlow<HelloWorldFlow>();
});
builder.Services.AddStepHandler<LogMessageHandler>("LogMessage");
builder.Services.AddFlowDashboard(builder.Configuration);
var app = builder.Build();
app.MapFlowDashboard("/flows");