AxisSaga 2.2.0

dotnet add package AxisSaga --version 2.2.0
                    
NuGet\Install-Package AxisSaga -Version 2.2.0
                    
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="AxisSaga" Version="2.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AxisSaga" Version="2.2.0" />
                    
Directory.Packages.props
<PackageReference Include="AxisSaga" />
                    
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 AxisSaga --version 2.2.0
                    
#r "nuget: AxisSaga, 2.2.0"
                    
#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 AxisSaga@2.2.0
                    
#: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=AxisSaga&version=2.2.0
                    
Install as a Cake Addin
#tool nuget:?package=AxisSaga&version=2.2.0
                    
Install as a Cake Tool

AxisSaga — Documentation

🌐 Português (documentação navegável)

Orchestration of long-running, multi-step processes with compensations — declarative saga definitions (forward stages, error stages, success routing, route-to compensation), per-stage handlers returning AxisResult<TPayload>, a bundled storage adapter (Postgres, MySQL, …) over a shared core that persists every instance, every stage log and the definition catalogue, and a built-in poll-based resumer that recovers stuck sagas after a process restart.

public static class OrderSagaDefinition
{
    public static void Configure(IAxisSagaConfigurator<OrderPayload> saga)
    {
        saga.AddStage("ReserveStock")
            .NextStageOnSuccess("ChargeCard")
            .RouteToOnError("CompensateOrder");

        saga.AddStage("ChargeCard")
            .FinishOnSuccess()
            .RouteToOnError("RefundStock", "CompensateOrder");

        saga.AddErrorStage("RefundStock")     /* … */;
        saga.AddErrorStage("CompensateOrder") /* … */;
    }
}

Use this page as a map: read the trunk below (~5 min) and jump straight to the detail of the group you need — without reading hundreds of lines.


The trunk (read first)

What a saga is

A saga is a long-running process composed of stages that run in order. Each stage runs an IAxisSagaStageHandler<TPayload> that returns AxisResult<TPayload> — success advances to the next stage; failure routes to one or more error stages (the classic compensation pattern). If a stage needs to notify the rest of the system, its own handler publishes the event on the IAxisBus, on the same unit of work that persists the stage's state change — the saga runtime itself does not publish anything.

The five participating types

Type What it is
IAxisSagaStageHandler<TPayload> a per-stage handler that runs one step and returns AxisResult<TPayload>
IAxisSagaConfigurator<TPayload> the fluent builder that declares the stages and routes
AxisSagaDefinition the immutable, validated definition that the registry exposes at runtime
IAxisSagaMediator start a saga, fetch its state, or ask for it to resume
IAxisSagaResumer a poll-based recovery worker that looks for stuck sagas and re-fires the engine

→ Concepts · stages and routes · IAxisSagaConfigurator<TPayload> — the fluent builder · Writing a stage handler · Driving a saga — IAxisSagaMediator · Resuming · IAxisSagaResumer

Storage adapters — Postgres, MySQL, …

The schema is declared once, dialect-agnostically, in the core (AxisSagaSchema) and rendered per dialect: a single schema (AXIS_SAGA) with four tables — saga_definitions, saga_instances, saga_stage_logs and saga_settings — plus a MIGRATIONS control table created by the framework migration runner. The core supplies the SagaEngine that drives one instance forward (load → resolve stage → invoke handler → write log → route), the SagaMediator that inserts a new instance and fires the engine in the background, and the built-in resumer. The bundled storage adapters share that core — currently AxisSaga.Postgres (AddAxisSagaPostgres), AxisSaga.MySql (AddAxisSagaMySql), and more can follow — each supplying only its data source, store implementations and migration runner.

→ Postgres adapter · MySQL adapter · Database schema

Installation

dotnet add package AxisSaga              # contracts + configurator
dotnet add package AxisSaga.Postgres     # the Postgres storage adapter (or AxisSaga.MySql)

AxisSaga depends on AxisResult, AxisLogger, AxisMediator.Contracts. AxisSaga.Postgres adds Npgsql.

→ Full guide: Getting started


The map (jump to what you need)

Group You want to… Detail
Concepts · stages and routes understand the moving parts concepts.md
Configurator · IAxisSagaConfigurator<TPayload> ⭐ declare a saga end-to-end configuration.md
Stage handlers write a handler that runs one stage stage-handlers.md
Mediator · IAxisSagaMediator start a saga, read its state, resume it mediator.md
Resumer · IAxisSagaResumer recover stuck instances after a restart resumer.md
Postgres adapter the storage + engine postgres-adapter.md
MySQL adapter the storage + engine mysql-adapter.md
Database schema what the adapter creates database-schema.md
Why? the case for the abstraction why-axissaga.md
Reference every member at a glance api-reference.md

Start here: Getting started · Concepts · Why AxisSaga?

Fundamentals: Configurator · Stage handlers · Mediator · Resumer

Reference & extras: Postgres adapter · MySQL adapter · Database schema · API reference


Design principles

  1. Sagas are declarative. Stages, next-on-success and route-to-on-error are data (AxisSagaDefinition), not handler-level conditionals.
  2. Compensation is first-class. A failed forward stage routes to a sequence of error stages — there is no "throw an exception and hope for the best".
  3. Every step is logged. Each stage's start / completion / failure is a row in axis_saga.saga_stage_logs. Forensics are a SQL query.
  4. The engine resumes itself. The core ships a built-in resumer (an auto-hosted worker) that finds stuck instances and re-triggers the engine — process restart is not a saga restart.
  5. One storage per process. AddAxisSagaPostgres refuses a second registration on purpose: every saga across every BC shares the AXIS_SAGA schema.

License

Apache 2.0

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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on AxisSaga:

Package Downloads
AxisSaga.MySql

Part of the Axis Framework — an opinionated, ports-and-adapters .NET framework.

AxisSaga.Postgres

Part of the Axis Framework — an opinionated, ports-and-adapters .NET framework.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.2.0 316 7/21/2026
2.1.1 148 7/17/2026
2.1.0 145 7/17/2026
2.0.1 159 7/15/2026
2.0.0 162 7/15/2026