Soenneker.ConcurrentProcessing.Executor 11.0.377

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

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

Soenneker.ConcurrentProcessing.Executor

Runs a finite collection of asynchronous work with a fixed concurrency limit and optional per-item retries.

Install

dotnet add package Soenneker.ConcurrentProcessing.Executor

Execute state-based work

Construct an executor with a positive concurrency limit. The state-based overload avoids creating a closure for every item:

using Soenneker.ConcurrentProcessing.Executor;

var executor = new ConcurrentProcessingExecutor(maxConcurrency: 8);

await executor.Execute(
    customerIds,
    static async (customerId, cancellationToken) =>
    {
        await SynchronizeCustomer(customerId, cancellationToken);
    },
    cancellationToken);

Each item is claimed once. Work-item failures are logged when an ILogger is supplied, other items continue, and the completed batch throws an AggregateException containing the failures.

Execute task factories

Use the delegate-list overload when the work is already represented by task factories:

var work = urls
    .Select(url => (Func<Task>)(() => Download(url, cancellationToken)))
    .ToList();

await executor.Execute(work, cancellationToken);

The factories do not receive the executor's cancellation token. Cancellation prevents new factories from starting; running factories stop only if they observe cancellation through their own captured state.

Retry failed work

var work = customerIds
    .Select(id => (Func<CancellationToken, ValueTask>)(ct => SynchronizeCustomer(id, ct)))
    .ToList();

await executor.ExecuteWithRetry(
    work,
    maxRetries: 4,
    initialDelayMs: 250,
    cancellationToken);

maxRetries is the total attempt count, including the first call. Delays use exponential backoff with full jitter and are capped at 30 seconds. An item that exhausts its attempts does not prevent later items from running. Exhausted failures are collected and thrown as an AggregateException after the batch; cancellation is never retried.

Operational notes

  • This is an in-process batch executor, not a durable queue or background service.
  • Do not mutate the supplied list until execution completes.
  • A single executor can be reused across batches; the concurrency limit applies independently to each simultaneous Execute call, not globally across the instance.
  • Retries require idempotent work or an operation-specific strategy for handling partial success.
  • The logger is optional and does not replace exception handling by the caller.
Product Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
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 Soenneker.ConcurrentProcessing.Executor:

Package Downloads
Soenneker.Cosmos.Repository

A data persistence abstraction layer for Cosmos DB

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
11.0.380 210 10/27/2026
11.0.379 314 10/26/2026
11.0.378 100 10/26/2026
11.0.377 85 10/26/2026
11.0.376 109 10/26/2026
11.0.375 55 10/26/2026
11.0.374 89 10/26/2026
4.0.373 75 10/26/2026
4.0.372 719 10/15/2026
4.0.371 85 10/15/2026
4.0.370 167 10/14/2026
4.0.369 139 10/14/2026
4.0.368 155 10/14/2026
4.0.367 91 10/14/2026
4.0.366 143 10/14/2026
4.0.365 99 10/14/2026
4.0.359 156 10/13/2026
4.0.358 99 10/13/2026
4.0.355 315 10/12/2026
4.0.354 101 10/12/2026
Loading failed

Update dependency Soenneker.Utils.Delay to 11.0.107 (#972)