Fcop.BatchEngine 2.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package Fcop.BatchEngine --version 2.0.2
                    
NuGet\Install-Package Fcop.BatchEngine -Version 2.0.2
                    
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="Fcop.BatchEngine" Version="2.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Fcop.BatchEngine" Version="2.0.2" />
                    
Directory.Packages.props
<PackageReference Include="Fcop.BatchEngine" />
                    
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 Fcop.BatchEngine --version 2.0.2
                    
#r "nuget: Fcop.BatchEngine, 2.0.2"
                    
#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 Fcop.BatchEngine@2.0.2
                    
#: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=Fcop.BatchEngine&version=2.0.2
                    
Install as a Cake Addin
#tool nuget:?package=Fcop.BatchEngine&version=2.0.2
                    
Install as a Cake Tool

Fcop.BatchEngine

Unified EF Core batch orchestration engine for idempotent row claiming, lifecycle management, and automatic retries.

Quick start

Use in your Worker Service (Program.cs):

var builder = Host.CreateDefaultBuilder(args)
    .ConfigureAppConfiguration((ctx, cfg) =>
    {
        cfg.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);
        cfg.AddEnvironmentVariables();
    })
    .ConfigureServices((ctx, services) =>
    {
        // Register DbContext
        services.AddDbContext<AppDbContext>(opts =>
        {
            opts.UseOracle(ctx.Configuration.GetConnectionString("Oracle"));
        });

        // Register engine (lifecycle + worker + orchestrator)
        services.AddBatchEngine<AppDbContext, Batch, PurchaseOrder>();

        // Register per-table adapters
        services.AddScoped<IChildClaimSpec<PurchaseOrder>, PurchaseClaimSpec>();
        services.AddScoped<IChildInBatchClaimSpec<PurchaseOrder>, PurchaseInBatchRetrySpec>();
        services.AddScoped<IChildProcessor<PurchaseOrder>, PurchaseProcessor>();

        // Bind options from appsettings.json (with optional overrides)
        services.AddBatchEngineOptions(
            ctx.Configuration,
            batchRunOverride: opts =>
            {
                // Optional overrides
                // opts.MaxRows = 50;
                // opts.DelayMinutes = 5;
                // opts.RetryBackoff = TimeSpan.FromMinutes(1);
                // opts.MaxBatchAttempts = 3;
            },
            orchestratorOverride: orch =>
            {
                // Optional overrides
                // orch.MaxParallelRuns = 4;
                // orch.SpawnInterval = TimeSpan.FromSeconds(5);
                // orch.AlwaysProbeWhenIdle = true;
            });

        // Hosted service runs orchestrator forever
        services.AddHostedService(sp =>
        {
            var logger = sp.GetRequiredService<ILogger<PurchaseHostedService>>();
            var scopeFactory = sp.GetRequiredService<IServiceScopeFactory>();
            var batchRun = sp.GetRequiredService<BatchRunOptions>();
            var orchRun = sp.GetRequiredService<BatchRunOrchestratorOptions>();

            return new PurchaseHostedService(logger, scopeFactory, batchRun, orchRun);
        });
    })
    .ConfigureLogging(logging =>
    {
        logging.ClearProviders();
        logging.AddConsole();
    });

await builder.Build().RunAsync();

Configuration (appsettings.json)

{
  "ConnectionStrings": {
    "Oracle": "User Id=FCOP;Password=***;Data Source=***"
  },
  "BatchRunOptions": {
    "MaxBatchAttempts": 3,
    "RetryBackoff": "00:01:00",
    "MaxRows": 100,
    "DelayMinutes": 10
  },
  "BatchRunOrchestratorOptions": {
    "MaxParallelRuns": 2,
    "SpawnInterval": "00:00:10",
    "AlwaysProbeWhenIdle": true
  }
}

Features

  • Lifecycle management: New → InProgress → Success | Failed | PartiallyFailed.
  • Automatic retries: Failed/partial batches retried based on UpdatedOn + RetryBackoff up to MaxBatchAttempts.
  • Parallel orchestration: Spawn multiple RunUntilIdleAsync instances with MaxParallelRuns and SpawnInterval.

Requirements

  • .NET 8
  • EF Core 8 (Microsoft.EntityFrameworkCore, Microsoft.EntityFrameworkCore.Relational)
  • Database provider (e.g., Oracle.EntityFrameworkCore)
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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. 
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.1.0 325 12/17/2025
2.0.3 296 12/17/2025
2.0.2 299 12/17/2025
2.0.1 294 12/17/2025
2.0.0 295 12/16/2025
1.0.0 145 12/12/2025