Soenneker.ConcurrentProcessing.Executor
4.0.327
Prefix Reserved
dotnet add package Soenneker.ConcurrentProcessing.Executor --version 4.0.327
NuGet\Install-Package Soenneker.ConcurrentProcessing.Executor -Version 4.0.327
<PackageReference Include="Soenneker.ConcurrentProcessing.Executor" Version="4.0.327" />
<PackageVersion Include="Soenneker.ConcurrentProcessing.Executor" Version="4.0.327" />
<PackageReference Include="Soenneker.ConcurrentProcessing.Executor" />
paket add Soenneker.ConcurrentProcessing.Executor --version 4.0.327
#r "nuget: Soenneker.ConcurrentProcessing.Executor, 4.0.327"
#:package Soenneker.ConcurrentProcessing.Executor@4.0.327
#addin nuget:?package=Soenneker.ConcurrentProcessing.Executor&version=4.0.327
#tool nuget:?package=Soenneker.ConcurrentProcessing.Executor&version=4.0.327
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
Executecall, 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 | Versions 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. |
-
net10.0
- Soenneker.Atomics.Ints (>= 4.0.40)
- Soenneker.Extensions.Enumerable (>= 4.0.658)
- Soenneker.Utils.Delay (>= 4.0.84)
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 |
|---|---|---|
| 4.0.327 | 381 | 9/4/2026 |
| 4.0.324 | 1,213 | 8/29/2026 |
| 4.0.323 | 148 | 8/29/2026 |
| 4.0.322 | 82 | 8/29/2026 |
| 4.0.321 | 659 | 8/26/2026 |
| 4.0.320 | 227 | 8/25/2026 |
| 4.0.319 | 1,615 | 8/12/2026 |
| 4.0.318 | 93 | 8/12/2026 |
| 4.0.317 | 1,752 | 7/28/2026 |
| 4.0.316 | 203 | 7/28/2026 |
| 4.0.315 | 180 | 7/28/2026 |
| 4.0.314 | 156 | 7/28/2026 |
| 4.0.312 | 137 | 7/27/2026 |
| 4.0.311 | 1,118 | 7/18/2026 |
| 4.0.310 | 413 | 7/17/2026 |
| 4.0.309 | 366 | 7/16/2026 |
| 4.0.308 | 108 | 7/16/2026 |
| 4.0.307 | 236 | 7/16/2026 |
| 4.0.306 | 100 | 7/16/2026 |
| 4.0.305 | 470 | 7/15/2026 |
Aggregate concurrent processing failures