Ananke.StateMachine 0.2.0

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

Ananke.StateMachine

NuGet License

Distributed state machine engine for .NET — RedLock coordination, composable middleware pipeline, guard conditions, and fault/reset circuit breaking.

Install

dotnet add package Ananke.StateMachine

Quick start

Define states, transitions, and wire them up:

public class OrderMachine(IDistributedLock locker)
    : AbstractStateMachine<OrderCtx, OrderState, OrderTransition, OrderEvent>(
        OrderState.Pending, locker)
{
    protected override Action<ITransitionBuilder<OrderState, OrderTransition>> Transitions => b => b
        .From(OrderState.Pending)
            .On(OrderTransition.Reserve).GoTo(OrderState.Reserved)
            .On(OrderTransition.Cancel).GoTo(OrderState.Cancelled)
        .From(OrderState.Reserved)
            .On(OrderTransition.Confirm).GoTo(OrderState.Confirmed)
            .On(OrderTransition.Cancel).GoTo(OrderState.Cancelled);
}

DI registration

using Ananke.StateMachine.Extensions;

services.AddStateMachine(o => o
    .AllowImplicitSelfTransitions(false)
    .ConfigureLockRetry(maxRetries: 5));

// Register your concrete state machine
services.AddStateMachine<OrderMachine, OrderCtx, OrderState, OrderTransition, OrderEvent>();

AddStateMachine registers an in-memory IDistributedLock by default. Add Ananke.Redis to replace it with Redis-backed locking — call order doesn't matter.

Features

  • Distributed locking — safe coordination across instances via IDistributedLock
  • Composable middleware — intercept every transition for logging, metrics, validation
  • Guard conditions — block transitions based on runtime state
  • Fault / Reset — circuit-breaker pattern (OperationalStatus.Faulted blocks all transitions until ResetAsync)
  • Lifecycle hooksOnEnter / OnExit per state
  • OpenTelemetry tracing — built-in ActivitySource for transition spans
Package What it adds
Ananke.Redis Redis-backed IDistributedLock and IKeyValueDataAdapter
Ananke.MQTT MQTT-backed pub/sub channels for distributed messaging
Ananke Meta-package — includes StateMachine + Orchestration + Bridge

Documentation

Full docs, demos, and architecture: github.com/sevensamurai/Ananke

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 (1)

Showing the top 1 NuGet packages that depend on Ananke.StateMachine:

Package Downloads
Ananke

Ananke — distributed state machine + workflow orchestration for .NET. Install this meta-package to get StateMachine, Orchestration, and the Bridge integration layer in one step.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.2.0 31 3/6/2026
0.1.0 42 3/3/2026