WorkflowForge.Extensions.Persistence.Recovery 2.0.0

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

WorkflowForge.Extensions.Persistence.Recovery

<p align="center"> <img src="https://raw.githubusercontent.com/animatlabs/workflow-forge/main/icon.png" alt="WorkflowForge" width="120" height="120"> </p>

Recovery orchestration extension for WorkflowForge to resume persisted workflows from the last checkpoint with configurable retry and backoff.

NuGet

Zero Dependencies - Zero Conflicts

This extension has ZERO external dependencies. This means:

  • NO DLL Hell - No third-party dependencies to conflict with
  • NO Version Conflicts - Works with any versions of your application dependencies
  • Clean Deployment - Pure WorkflowForge extension

Lightweight architecture: Built entirely on WorkflowForge core and Persistence abstractions.

Installation

dotnet add package WorkflowForge.Extensions.Persistence.Recovery

Requires: .NET Standard 2.0 or later

Quick Start

using WorkflowForge;
using WorkflowForge.Extensions.Persistence.Abstractions;
using WorkflowForge.Extensions.Persistence.Recovery;

// Your provider must be shared (DB/cache) used also by the runtime persistence middleware
IWorkflowPersistenceProvider provider = new SQLitePersistenceProvider("workflows.db");

var coordinator = new RecoveryCoordinator(provider, new RecoveryPolicy
{
    MaxAttempts = 3,
    BaseDelay = TimeSpan.FromSeconds(1),
    UseExponentialBackoff = true
});

await coordinator.ResumeAsync(
    foundryFactory: () => WorkflowForge.CreateFoundry("OrderService"),
    workflowFactory: BuildProcessOrderWorkflow,
    foundryKey: stableFoundryKey,
    workflowKey: stableWorkflowKey);

Key Features

  • Resume from Checkpoint: Continue workflows from last saved state
  • Exponential Backoff: Configurable retry with backoff
  • Skip Completed: Automatically skip already-completed operations
  • Catalog-Based: Batch resume for multiple workflows
  • Minimal Retry: Resilient recovery on resume failures
  • Zero Dependencies: Pure WorkflowForge extension

Configuration

Via appsettings.json

{
  "WorkflowForge": {
    "Extensions": {
      "Recovery": {
        "Enabled": true,
        "MaxRetryAttempts": 3,
        "BaseDelay": "00:00:01",
        "UseExponentialBackoff": true,
        "AttemptResume": true,
        "LogRecoveryAttempts": true
      }
    }
  }
}

Via Code

using WorkflowForge.Extensions.Persistence.Recovery.Options;

var options = new RecoveryMiddlewareOptions
{
    Enabled = true,
    MaxRetryAttempts = 3,
    BaseDelay = TimeSpan.FromSeconds(1),
    UseExponentialBackoff = true,
    AttemptResume = true,
    LogRecoveryAttempts = true
};

await smith.ForgeWithRecoveryAsync(
    workflow,
    foundry,
    provider,
    foundryKey,
    workflowKey,
    options);

Via Dependency Injection

using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using WorkflowForge.Extensions.Persistence.Recovery;

services.AddRecoveryConfiguration(configuration);
var options = serviceProvider.GetRequiredService<IOptions<RecoveryMiddlewareOptions>>().Value;

See Configuration Guide for complete options.

Usage Patterns

Single Workflow Recovery

// Resume from last checkpoint
await coordinator.ResumeAsync(
    foundryFactory: () => WorkflowForge.CreateFoundry("OrderService"),
    workflowFactory: BuildProcessOrderWorkflow,
    foundryKey: stableFoundryKey,
    workflowKey: stableWorkflowKey);

Batch Recovery

public class MyCatalog : IRecoveryCatalog
{
    private readonly IWorkflowPersistenceProvider _provider;
    
    public async Task<IReadOnlyList<WorkflowExecutionSnapshot>> ListPendingAsync(
        CancellationToken cancellationToken = default)
    {
        // Query your storage for pending workflows
        return await _database.QueryAsync("SELECT * FROM Workflows WHERE Status = 'Pending'");
    }
}

var catalog = new MyCatalog(provider);
int resumedCount = await coordinator.ResumeAllAsync(
    foundryFactory: () => WorkflowForge.CreateFoundry("BatchRecovery"),
    workflowFactory: BuildWorkflow,
    catalog: catalog);

Important Notes

Stable Keys

Critical: Use stable, deterministic keys for foundry and workflow:

// Good: Stable keys
var foundryKey = Guid.Parse("FIXED-GUID-FOR-ORDER-SERVICE");
var workflowKey = Guid.Parse("FIXED-GUID-FOR-WORKFLOW-DEF");

// Bad: Random keys (won't find saved state)
var foundryKey = Guid.NewGuid();  // Different every time!

Operation Order

Keep workflow operation order stable across versions:

// Version 1
workflow
    .AddOperation("ValidateOrder")
    .AddOperation("ChargePayment")
    .Build();

// Version 2 - OK: Append new operations
workflow
    .AddOperation("ValidateOrder")
    .AddOperation("ChargePayment")
    .AddOperation("SendNotification")  // New operation
    .Build();

// Version 2 - BAD: Reorder existing operations
workflow
    .AddOperation("ChargePayment")      // Order changed!
    .AddOperation("ValidateOrder")      // Recovery will break
    .Build();

State Restoration

Ensure necessary state is in foundry.Properties:

// Good: Store state in properties
foundry.SetProperty("OrderId", orderId);
foundry.SetProperty("CustomerId", customerId);
foundry.SetProperty("PaymentId", paymentId);

// Operations can access this state after recovery
var orderId = foundry.GetPropertyOrDefault<string>("OrderId");

Recovery Flow

  1. Load Snapshot: Retrieve saved workflow state from provider
  2. Restore Properties: Populate foundry with saved properties
  3. Skip Completed: Start from NextOperationIndex
  4. Resume Execution: Continue workflow from checkpoint
  5. Retry on Failure: Use recovery policy for transient failures

Error Handling

try
{
    await coordinator.ResumeAsync(...);
}
catch (RecoveryException ex)
{
    logger.LogError(ex, "Failed to resume workflow after {Attempts} attempts", ex.Attempts);
    // Handle permanent failure
}

Documentation


Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
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.0 92 1/26/2026
1.0.0 176 8/9/2025

Major release v2.0.0:
- Dependency isolation: Microsoft/System assemblies resolved by runtime
- ISystemTimeProvider integrated for testability
- Enhanced documentation and samples
- Enterprise-ready for production workflows