FlowOrchestrator.Testing 2.0.0-alpha.223

This is a prerelease version of FlowOrchestrator.Testing.
There is a newer version of this package available.
See the version list below for details.
dotnet add package FlowOrchestrator.Testing --version 2.0.0-alpha.223
                    
NuGet\Install-Package FlowOrchestrator.Testing -Version 2.0.0-alpha.223
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="FlowOrchestrator.Testing" Version="2.0.0-alpha.223" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="FlowOrchestrator.Testing" Version="2.0.0-alpha.223" />
                    
Directory.Packages.props
<PackageReference Include="FlowOrchestrator.Testing" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add FlowOrchestrator.Testing --version 2.0.0-alpha.223
                    
#r "nuget: FlowOrchestrator.Testing, 2.0.0-alpha.223"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package FlowOrchestrator.Testing@2.0.0-alpha.223
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=FlowOrchestrator.Testing&version=2.0.0-alpha.223&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=FlowOrchestrator.Testing&version=2.0.0-alpha.223&prerelease
                    
Install as a Cake Tool

FlowOrchestrator

Code-first DAG orchestration for .NET. Runs on Hangfire, in-process, or Azure Service Bus.

CI CodeQL Tests NuGet Downloads .NET License Last Commit Stars

πŸ“– Documentation Β· NuGet Β· GitHub


FlowOrchestrator dashboard: Overview with the "Needs attention" list, runs-per-hour chart and recent runs


What's new in 2.0 β€” Hangfire becomes an opt-in runtime: AddFlowOrchestrator() ships in FlowOrchestrator.Core, so InMemory and Azure Service Bus hosts no longer pull Hangfire in (Hangfire stays a fully supported runtime). Targets .NET 10 and .NET 11 (hosts on .NET 8/9 stay on 1.34.x). Redesigned dashboard: a dense operator view that leads with what needs attention. Index-backed run search: SQL Server quick search 88-178 ms β†’ 5-7 ms, PostgreSQL 16-150 ms β†’ 1-3.5 ms, with run-id prefix matching and keyset paging. Webhook security defaults to Enforce. Crash recovery by step leases: a worker killed mid-step no longer leaves its run Running for ever β€” its lease expires and another worker takes the step over, with every late write of the dead attempt fenced off. Flat ForEach cost: the continuation reads only the changed step's frontier, so store rows read per completion stay at ~4 however long the loop (a 1 000-item loop 850 ms β†’ 62 ms). Correctness fixes for failed dispatches, signals sent by disconnecting clients, concurrent ForEach completion, workers that die after claiming a step, idempotent retries of a trigger that died before its run started, and racing dashboard retries. Persisted run events and the dead 1.x shims are removed.

Upgrading from 1.x: read Migrating to 2.0 first β€” it has a package matrix per runtime, the breaking changes with replacements, and a rollback plan. Full history in the CHANGELOG.


When to choose FlowOrchestrator

βœ… Choose FlowOrchestrator if:

  • You want multi-step DAGs in .NET without standing up a separate workflow server
  • Your team writes C# and wants flows defined as plain code, not JSON or a designer
  • You need conditional branching (When), polling, fan-out (ForEach), human-in-loop (WaitForSignal), and cron in one library
  • You want a built-in dashboard with Timeline, DAG, and Gantt views
  • You want flows that are unit-testable in-process (FlowTestHost) and renderable as Mermaid diagrams in a PR
  • You already use Hangfire β€” or want Azure Service Bus for cloud-native multi-replica scale-out β€” or want zero infrastructure at all (in-process runtime works without Hangfire or a database)

❌ Choose something else if:

  • You need multi-language workflows (Python + Go + .NET) β†’ Temporal
  • You want replay-based deterministic execution β†’ Temporal
  • You're running a service mesh and want workflow as one of several building blocks β†’ Dapr Workflows
  • Non-developers need to author workflows in a visual designer β†’ Elsa Workflows
  • You only need fire-and-forget background jobs with no DAG β†’ Hangfire alone

FlowOrchestrator is intentionally narrow. It is the DAG layer Hangfire is missing β€” nothing more, nothing less.


How it compares

Hangfire FlowOrchestrator Elsa v3 Temporal .NET Dapr Workflows
Background job execution βœ“ βœ“ (Hangfire, in-process, or Service Bus) βœ“ βœ“ βœ“
Multi-step DAG with runAfter Manual βœ“ βœ“ Implicit (code) Implicit (code)
Polling pattern (no thread block) Manual βœ“ built-in βœ“ βœ“ durable timers βœ“ durable timers
Code-first C# definitions βœ“ βœ“ βœ“ βœ“ βœ“
JSON / YAML workflow files βœ— βœ— by design βœ“ βœ— βœ—
Visual designer βœ— βœ— by design βœ“ Studio βœ— βœ—
Built-in DAG / Gantt / Timeline UI βœ— βœ“ βœ“ Studio βœ“ Web UI βœ—
Polyglot SDK .NET only .NET only .NET only Go, Java, TS, Python, .NET .NET, Python, JS, Java, Go
Separate server / sidecar required βœ— βœ— Optional βœ“ Required βœ“ Sidecar
Storage you already have SQL Server, PG, Redis SQL Server, PG, in-memory SQL Server, PG, MongoDB Cassandra, MySQL, PG State store of choice
Runtime / dispatcher options n/a Hangfire, in-process, Azure Service Bus Hangfire, Quartz Built-in cluster Built-in actor system
Deterministic replay βœ— βœ— βœ— βœ“ βœ“
External signals / human-in-loop βœ— βœ“ WaitForSignal βœ“ βœ“ βœ“
Operational complexity Low Low Low–Medium High Medium
Learning curve (.NET dev) Low Low Medium Medium–High Medium

FlowOrchestrator deliberately ships fewer features than Temporal or Dapr Workflows. It does not replay. It does not run a separate server. It is for teams that want DAG orchestration inside their existing ASP.NET Core app β€” alongside Hangfire if they have it, or fully in-process if they do not.

Comparison verified 2026-04-30 against Elsa v3, Temporal .NET SDK v1, Dapr .NET SDK v1. PRs welcome to keep it current.


Coming from Hangfire?

// Before β€” recurring job with manual chaining, no DAG, no run history
RecurringJob.AddOrUpdate<NightlyOrdersJob>("nightly-orders",
    job => job.RunAsync(), "0 2 * * *");
// Inside RunAsync: call FetchOrders, then SubmitToWms, then NotifySlack.
// Error branching, retry-per-step, run history, Gantt view β€” all on you.

// After β€” FlowOrchestrator declarative manifest
public sealed class NightlyOrdersFlow : IFlowDefinition
{
    public Guid Id { get; } = new("a1b2c3d4-0000-0000-0000-000000000001");
    public string Version => "1.0";
    public FlowManifest Manifest { get; set; } = new()
    {
        Triggers = { ["cron"] = new() { Type = TriggerType.Cron,
            Inputs = { ["cronExpression"] = "0 2 * * *" } } },
        Steps = {
            ["fetch"]  = new() { Type = "FetchOrders" },
            ["submit"] = new() { Type = "SubmitToWms",
                RunAfter = { ["fetch"]  = [StepStatus.Succeeded] } },
            ["notify"] = new() { Type = "NotifySlack",
                RunAfter = { ["submit"] = [StepStatus.Succeeded] } }
        }
    };
}
// Dashboard, per-step retry, full run history, DAG view β€” included.

And yes β€” your flows are testable. See FlowOrchestrator.Testing for a one-liner test host that runs flows in-process without Hangfire or ASP.NET.

Coming from Temporal or Dapr?

If you don't need replay-based determinism and a separate cluster, here is the simpler model:

// Temporal .NET β€” deterministic replay; requires Temporal Server cluster
[Workflow]
public class OrderWorkflow
{
    [WorkflowRun]
    public async Task RunAsync(string orderId)
    {
        await Workflow.ExecuteActivityAsync(
            (Activities a) => a.FetchOrderAsync(orderId),
            new() { ScheduleToCloseTimeout = TimeSpan.FromMinutes(5) });
        await Workflow.ExecuteActivityAsync(
            (Activities a) => a.SubmitToWmsAsync(orderId),
            new() { ScheduleToCloseTimeout = TimeSpan.FromMinutes(5) });
    }
}
// Requires: Temporal Server (Cassandra / MySQL / PG + Elasticsearch + server cluster)

// FlowOrchestrator β€” same outcome, runs inside your existing ASP.NET Core app
public sealed class OrderFlow : IFlowDefinition
{
    public Guid Id { get; } = new("a1b2c3d4-0000-0000-0000-000000000002");
    public string Version => "1.0";
    public FlowManifest Manifest { get; set; } = new()
    {
        Triggers = { ["manual"] = new() { Type = TriggerType.Manual } },
        Steps = {
            ["fetch"]  = new() { Type = "FetchOrder" },
            ["submit"] = new() { Type = "SubmitToWms",
                RunAfter = { ["fetch"] = [StepStatus.Succeeded] } }
        }
    };
}
// Requires: SQL Server or PostgreSQL you already have, plus Hangfire or Azure Service Bus as the
// runtime β€” or nothing extra at all with the in-process runtime.

Why FlowOrchestrator?

  • Zero new infrastructure (or your choice) β€” runs inside your existing Hangfire app on SQL Server / PostgreSQL, in-process with a Channel<T> and zero deps, or on Azure Service Bus for cloud-native scale-out.
  • Code-first, always β€” flows are plain C# classes; no YAML, no JSON files, no designer to learn.
  • Built-in dashboard with realtime updates β€” an operator view that puts failed and long-running runs first, with step, graph and timing views and retry, cancel, and re-run controls; state changes stream over Server-Sent Events the moment they happen, polling only kicks in if the stream stalls.
  • Runtime-agnostic core β€” three runtimes ship today (Hangfire, in-process, Azure Service Bus); add your own without touching flow definitions.

The dashboard

app.MapFlowDashboard("/flows") serves a built-in operator UI and REST API: no separate server, no build step, light and dark themes.

Run detail: the failing step's error sits under the header, with collapsible error, input and output panels and per-step Retry Runs: searchable list with run-id prefix search, flow and status filters, and paging
Run detail β€” the failing step's error is the first thing you see; retry the step or re-run the whole flow. Runs β€” search by run-id prefix, flow, trigger or status; opt in to searching step output and errors.
Graph view of a fan-in flow: three parallel API checks feeding one report step Overview in the dark theme
Graph β€” the run's DAG with per-step status and duration; click a step for its input, output and error. Dark theme β€” same layout, warm palette.

Protect it with Basic Auth (FlowDashboard:BasicAuth) or role-based access through FlowDashboardOptions.Authorization; with neither configured it is read-only outside Development. See Securing the dashboard and Dashboard & REST API.


Pick a runtime

FlowOrchestrator separates storage (where flow definitions and run history live) from the runtime adapter (which dispatches and executes steps).

Hangfire runtime InMemory runtime ServiceBus runtime
Step dispatcher IBackgroundJobClient Channel<T> inside the host process Azure Service Bus topic + per-flow subscription
Cron triggers IRecurringJobManager (multi-instance safe) PeriodicTimer (single-instance only) Self-perpetuating scheduled messages on a queue (multi-instance safe)
Survives process restart βœ“ (jobs in Hangfire storage) βœ— (in-memory queue) βœ“ (messages survive in the SB namespace)
Multi-instance horizontal scale βœ“ βœ— βœ“ (workers compete on the subscription)
Extra infrastructure Hangfire + SQL Server / PostgreSQL None Azure Service Bus namespace (or local emulator)
Best for Production workloads on .NET infra Local dev, integration tests, single-node side projects Cloud-native deployments, multi-region scale-out
Measured trigger throughput 17 req/s 63 req/s 2.5 req/s β€” see caveat

The throughput row is one measurement of one dimension: HTTP trigger acceptance, 13 flows, 32 concurrent, against the Service Bus emulator rather than a real namespace. The Service Bus number also has a 470Γ— spread between p50 (30 ms) and p95 (14 s), which looks like saturation rather than uniform cost. Whether that is the emulator or the runtime is not yet established β€” tracked in #192. Treat it as a reason to benchmark your own workload before committing to a runtime for a high-volume ingress, not as a verdict on Azure Service Bus. The other figures are from the same run on the same host.

Storage is independent β€” InMemory storage works only for dev / tests, while SQL Server and PostgreSQL are production-ready under any of the three runtimes.


Install

dotnet add package FlowOrchestrator.Core          # engine + AddFlowOrchestrator() β€” always

# Runtime adapter β€” pick one
dotnet add package FlowOrchestrator.Hangfire      # Hangfire jobs + recurring jobs β†’ options.UseHangfire()
dotnet add package FlowOrchestrator.InMemory      # In-process Channel<T> (dev / testing / single-node)
dotnet add package FlowOrchestrator.ServiceBus    # Azure Service Bus (cloud-native multi-instance)

# Storage backend β€” pick one
dotnet add package FlowOrchestrator.SqlServer     # or FlowOrchestrator.PostgreSQL
                                                   # FlowOrchestrator.InMemory ships its own storage too

# Optional
dotnet add package FlowOrchestrator.Dashboard     # REST API + SPA dashboard
dotnet add package FlowOrchestrator.Testing       # FlowTestHost β€” in-process integration test helper
dotnet add package FlowOrchestrator.OpenTelemetry # one-call OTel: traces + metrics + logs over OTLP

Which packages a host references, by runtime:

Runtime Packages Hangfire in the dependency graph?
Hangfire Core + Hangfire + a storage backend (SqlServer / PostgreSQL / InMemory), plus Hangfire's own Hangfire.AspNetCore and a Hangfire storage package Yes β€” it is the runtime
InMemory Core + InMemory (runtime and storage), or InMemory runtime + SqlServer / PostgreSQL storage No
Azure Service Bus Core + ServiceBus + a storage backend No

2.0 change: AddFlowOrchestrator(...) now ships in FlowOrchestrator.Core (namespace Microsoft.Extensions.DependencyInjection, so no extra using is needed). In 1.x it lived in FlowOrchestrator.Hangfire, which forced that package β€” and Hangfire.Core β€” onto InMemory and Service Bus hosts. Hangfire users keep referencing FlowOrchestrator.Hangfire exactly as before and keep calling options.UseHangfire(); it remains a fully supported runtime.


Quick Start β€” SQL Server + Hangfire

// Program.cs
builder.Services.AddHangfire(c => c
    .SetDataCompatibilityLevel(CompatibilityLevel.Version_170)
    .UseSimpleAssemblyNameTypeSerializer()
    .UseRecommendedSerializerSettings()
    .UseSqlServerStorage(connectionString));
builder.Services.AddHangfireServer();

builder.Services.AddFlowOrchestrator(options =>
{
    options.UseSqlServer(connectionString);       // persist + auto-migrate tables
    options.UseHangfire();                        // Hangfire step dispatcher
    options.AddFlow<OrderFulfillmentFlow>();
});

builder.Services.AddStepHandler<FetchOrdersStep>("FetchOrders");
builder.Services.AddStepHandler<SubmitToWmsStep>("SubmitToWms");
builder.Services.AddFlowDashboard(builder.Configuration); // optional

app.UseHangfireDashboard("/hangfire");
app.MapFlowDashboard("/flows");

Define a flow:

public sealed class OrderFulfillmentFlow : IFlowDefinition
{
    // Always use a fixed GUID literal β€” never Guid.NewGuid()
    public Guid Id { get; } = new("a1b2c3d4-0000-0000-0000-000000000003");
    public string Version => "1.0";
    public FlowManifest Manifest { get; set; } = new()
    {
        Triggers = {
            ["manual"]  = new() { Type = TriggerType.Manual },
            ["webhook"] = new() { Type = TriggerType.Webhook,
                Inputs = { ["webhookSlug"] = "order-fulfillment" } }
        },
        Steps = {
            ["fetch"]  = new() { Type = "FetchOrders" },
            ["submit"] = new() { Type = "SubmitToWms",
                RunAfter = { ["fetch"] = [StepStatus.Succeeded] } }
        }
    };
}

Open http://localhost:5000/flows β€” trigger the flow, watch steps execute in the DAG view, retry any failure.

Quick Start β€” InMemory (zero infrastructure)

For local development, prototypes, and single-node side projects β€” no Hangfire server, no database:

// Program.cs β€” packages: FlowOrchestrator.Core + FlowOrchestrator.InMemory. No Hangfire anywhere.
builder.Services.AddFlowOrchestrator(options =>
{
    options.UseInMemory();           // storage in-process
    options.UseInMemoryRuntime();    // Channel<T> dispatcher + PeriodicTimer cron
    options.AddFlow<OrderFulfillmentFlow>();
});

builder.Services.AddStepHandler<FetchOrdersStep>("FetchOrders");
builder.Services.AddStepHandler<SubmitToWmsStep>("SubmitToWms");
builder.Services.AddFlowDashboard(builder.Configuration);

app.MapFlowDashboard("/flows");

All run data is lost on restart β€” see Storage Backends for the full picture, and Production Checklist for why this combo is unsuitable for production.

For PostgreSQL, see πŸ“– Getting Started.


Quick Start β€” Azure Service Bus

For cloud-native deployments where workers scale horizontally across replicas/regions:

// Program.cs β€” runtime is Azure Service Bus, storage stays in your existing DB.
builder.Services.AddFlowOrchestrator(options =>
{
    options.UseSqlServer(connectionString);              // (or UsePostgreSql / UseInMemory)
    options.UseAzureServiceBusRuntime(sb =>
    {
        sb.ConnectionString   = builder.Configuration.GetConnectionString("ServiceBus")!;
        sb.AutoCreateTopology = true;                    // creates topic + sub-per-flow at startup
    });
    options.AddFlow<OrderFulfillmentFlow>();
});

builder.Services.AddStepHandler<FetchOrdersStep>("FetchOrders");
builder.Services.AddFlowDashboard(builder.Configuration);

app.MapFlowDashboard("/flows");

Topology β€” one topic (flow-steps) with one subscription per registered flow (SQL filter on FlowId); plus one queue (flow-cron-triggers) for self-perpetuating cron schedules. The engine's Dispatch many, Execute once invariant (dispatch ledger + claim guard) handles Service Bus's at-least-once delivery model β€” duplicate messages cannot run a step twice.

Local development uses the official Microsoft Service Bus emulator. The included Aspire AppHost wires it via AddAzureServiceBus("servicebus").RunAsEmulator(); run with dotnet run --project ./FlowOrchestrator.AppHost and the flow-servicebus instance comes up on port 5104.


Full documentation

Topic Link
Getting started (all runtimes) getting-started
Core concepts β€” Flow, Step, RunId core-concepts
Step handlers step-handlers
Trigger types triggers
Webhook hardening (HMAC, replay, rate limit, IP lists) webhook-hardening
Expression reference (@triggerBody()) expressions
Polling pattern polling
ForEach / fan-out foreach
Dashboard & REST API dashboard
Storage backends storage
Configuration reference configuration
Architecture architecture
Observability observability
Mermaid export mermaid-export
Conditional execution (When) conditional-execution
Human-in-loop (WaitForSignal) wait-for-signal
Testing flows (FlowTestHost) testing
Versioning flows in production versioning
Production deployment checklist production-checklist

Production?

Before changing any deployed flow, read Versioning Flows β€” it explains which manifest changes are safe and which need a maintenance window. Before go-live, walk through the Production Checklist for storage, multi-instance, monitoring, secrets, capacity, and upgrade guidance. Wire AddFlowOrchestratorHealthChecks() into /health so your load balancer can drop traffic when the flow store is unreachable.


Visualize any flow with one line

flow.ToMermaid() returns a Mermaid flowchart string that renders in GitHub READMEs, Notion, Confluence, and any modern Markdown surface β€” no running app required. Here is the sample OrderFulfillmentFlow:

flowchart TD
    classDef trigger fill:#e1f5ff,stroke:#0288d1
    classDef entry fill:#c8e6c9,stroke:#388e3c
    classDef polling fill:#fff9c4,stroke:#f57f17
    classDef loop fill:#f3e5f5,stroke:#7b1fa2

    T_manual["⚑ manual<br/>Manual"]:::trigger
    T_webhook["⚑ webhook<br/>Webhook /order-fulfillment"]:::trigger

    fetch_orders["fetch_orders<br/><i>QueryDatabase</i>"]:::entry
    submit_to_wms["submit_to_wms<br/><i>CallExternalApi</i>"]:::polling
    save_result["save_result<br/><i>SaveResult</i>"]

    T_manual --> fetch_orders
    T_webhook --> fetch_orders
    fetch_orders -- Succeeded --> submit_to_wms
    submit_to_wms -- Succeeded --> save_result

The dashboard ships a Copy Mermaid button on every flow detail page, and the sample app exposes --export-mermaid <flowId> for CI integrations.


Compatibility

Upgrading from 1.x to 2.0: see the migration guide. Hosts that must stay on .NET 8 / 9 use 1.34.x.

Package Target frameworks
FlowOrchestrator.Core net10.0 Β· net11.0
FlowOrchestrator.Hangfire net10.0 Β· net11.0
FlowOrchestrator.InMemory net10.0 Β· net11.0
FlowOrchestrator.ServiceBus net10.0 Β· net11.0
FlowOrchestrator.SqlServer net10.0 Β· net11.0
FlowOrchestrator.PostgreSQL net10.0 Β· net11.0
FlowOrchestrator.Dashboard net10.0 Β· net11.0
FlowOrchestrator.Testing net10.0 Β· net11.0
FlowOrchestrator.OpenTelemetry net10.0 Β· net11.0

Star History Chart


License

MIT β€” see the LICENSE file.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed.  net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.1-alpha.227 0 12/6/2026
2.0.1-alpha.226 54 11/28/2026
2.0.0 154 11/28/2026
2.0.0-alpha.224 53 11/28/2026
2.0.0-alpha.223 60 11/28/2026
2.0.0-alpha.221 65 11/28/2026
2.0.0-alpha.220 55 11/27/2026
2.0.0-alpha.218 62 11/27/2026
2.0.0-alpha.214 68 11/24/2026
2.0.0-alpha.213 61 11/23/2026
2.0.0-alpha.211 58 11/23/2026
2.0.0-alpha.209 58 11/23/2026
2.0.0-alpha.207 57 11/23/2026
1.34.8 99 11/27/2026
1.34.7 116 11/24/2026
1.34.6 96 11/24/2026
1.34.5 97 11/24/2026
1.34.4 93 11/23/2026
1.34.3 92 11/23/2026
1.34.2 95 11/23/2026
Loading failed