Soenneker.ConcurrentProcessing.Executor 3.0.147

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 3.0.147
                    
NuGet\Install-Package Soenneker.ConcurrentProcessing.Executor -Version 3.0.147
                    
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="3.0.147" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.ConcurrentProcessing.Executor" Version="3.0.147" />
                    
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 3.0.147
                    
#r "nuget: Soenneker.ConcurrentProcessing.Executor, 3.0.147"
                    
#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.
#addin nuget:?package=Soenneker.ConcurrentProcessing.Executor&version=3.0.147
                    
Install Soenneker.ConcurrentProcessing.Executor as a Cake Addin
#tool nuget:?package=Soenneker.ConcurrentProcessing.Executor&version=3.0.147
                    
Install Soenneker.ConcurrentProcessing.Executor 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

This executor efficiently handles multiple tasks with controlled concurrency. It is ideal for managing parallel execution of tasks while ensuring that no more than a specified number of tasks run simultaneously.

Key Features

  • Concurrent Execution: Limits the number of concurrent tasks to prevent overloading.
  • Failure Handling with Retry Logic: Automatically retries failed tasks with exponential backoff.
  • Async Semaphore: Uses a non-blocking semaphore to control concurrency and ensure thread safety.
  • CancellationToken support for task cancellation.

⚠️ Note:

  • This is not a background processor. It only manages concurrency for tasks that are provided during execution.

Installation

dotnet add package Soenneker.ConcurrentProcessing.Executor

Example: Executing Multiple Tasks with Concurrency Control

using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Soenneker.ConcurrentProcessing.Executor;

public class Program
{
    public static async Task Main(string[] args)
    {
        var executor = new ConcurrentProcessingExecutor(maxConcurrency: 3);

        var tasks = new List<Func<CancellationToken, ValueTask>>
        {
            async (ct) => { 
                Console.WriteLine("Task 1 started"); 
                await Task.Delay(500, ct); 
                Console.WriteLine("Task 1 completed"); 
            },

            async (ct) => { 
                Console.WriteLine("Task 2 started"); 
                await Task.Delay(300, ct); 
                Console.WriteLine("Task 2 completed"); 
            },

            async (ct) => { 
                Console.WriteLine("Task 3 started"); 
                await Task.Delay(700, ct); 
                Console.WriteLine("Task 3 completed");
            },

            async (ct) => { 
                Console.WriteLine("Task 4 started"); 
                await Task.Delay(400, ct); 
                Console.WriteLine("Task 4 completed"); 
            }
        };

        await executor.Execute(tasks);
    }
}

Console Output

Task 1 started
Task 2 started
Task 3 started
Task 1 completed
Task 4 started
Task 2 completed
Task 3 completed
Task 4 completed
Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  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 (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
3.0.151 342 5/14/2025
3.0.150 218 5/13/2025
3.0.149 669 5/8/2025
3.0.148 181 5/8/2025
3.0.147 120 5/8/2025
3.0.146 124 5/7/2025
3.0.145 381 5/5/2025
3.0.144 127 5/5/2025
3.0.143 118 5/5/2025
3.0.142 120 5/5/2025
3.0.141 123 5/5/2025
3.0.140 542 5/5/2025
3.0.139 1,325 4/8/2025
3.0.138 185 4/8/2025
3.0.137 149 4/8/2025
3.0.136 144 4/8/2025
3.0.135 142 4/8/2025
3.0.134 142 4/8/2025
3.0.133 142 4/8/2025
3.0.132 446 4/8/2025
3.0.131 281 4/8/2025
3.0.130 240 4/8/2025
3.0.129 332 4/8/2025
3.0.128 305 4/8/2025
3.0.127 256 4/7/2025
3.0.126 232 4/7/2025
3.0.125 406 4/7/2025
3.0.124 246 4/7/2025
3.0.123 353 4/7/2025
3.0.122 175 4/7/2025
3.0.121 132 4/7/2025
3.0.120 140 4/7/2025
3.0.119 131 4/6/2025
3.0.118 136 4/6/2025
3.0.117 156 4/6/2025
3.0.116 120 4/6/2025
3.0.115 118 4/6/2025
3.0.114 91 4/6/2025
3.0.113 79 4/6/2025
3.0.112 77 4/6/2025
3.0.111 97 4/6/2025
3.0.110 87 4/6/2025
3.0.109 86 4/6/2025
3.0.108 86 4/6/2025
3.0.107 63 4/5/2025
3.0.106 71 4/5/2025
3.0.105 72 4/5/2025
3.0.104 74 4/5/2025
3.0.103 69 4/5/2025
3.0.102 72 4/5/2025
3.0.101 77 4/5/2025
3.0.100 77 4/4/2025
3.0.99 70 4/4/2025
3.0.98 83 4/4/2025
3.0.97 1,962 4/3/2025
3.0.96 409 4/1/2025
3.0.95 257 4/1/2025
3.0.94 180 4/1/2025
3.0.93 381 3/31/2025
3.0.92 184 3/31/2025
3.0.91 337 3/31/2025
3.0.90 210 3/31/2025
3.0.89 200 3/29/2025
3.0.88 81 3/29/2025
3.0.87 118 3/29/2025
3.0.86 699 3/25/2025
3.0.85 514 3/25/2025
3.0.84 177 3/21/2025
3.0.83 205 3/21/2025
3.0.82 312 3/18/2025
3.0.81 226 3/18/2025
3.0.80 215 3/15/2025
3.0.79 107 3/15/2025
3.0.78 235 3/12/2025
3.0.77 153 3/12/2025
3.0.76 147 3/12/2025
3.0.75 156 3/12/2025
3.0.74 150 3/11/2025
3.0.73 162 3/11/2025
3.0.72 153 3/11/2025
3.0.71 389 3/11/2025
3.0.70 251 3/11/2025
3.0.69 214 3/11/2025
3.0.68 149 3/11/2025
3.0.67 226 3/11/2025
3.0.66 336 3/7/2025
3.0.65 253 3/7/2025
3.0.64 363 3/2/2025
3.0.63 215 3/2/2025
3.0.62 91 3/2/2025
3.0.61 147 3/2/2025
3.0.60 142 3/1/2025
3.0.59 184 3/1/2025
3.0.58 88 3/1/2025
3.0.57 130 3/1/2025
3.0.56 218 3/1/2025
3.0.55 80 3/1/2025
3.0.54 82 3/1/2025
3.0.53 78 3/1/2025
3.0.52 81 3/1/2025
3.0.51 163 3/1/2025
3.0.50 92 3/1/2025
3.0.49 289 2/25/2025
3.0.48 140 2/25/2025
3.0.47 143 2/25/2025
3.0.46 152 2/25/2025
3.0.45 91 2/25/2025
3.0.44 188 2/24/2025
3.0.43 162 2/23/2025
3.0.42 83 2/22/2025
3.0.41 262 2/22/2025
3.0.40 244 2/22/2025
3.0.39 187 2/22/2025
3.0.38 115 2/22/2025
3.0.37 150 2/22/2025
3.0.36 166 2/22/2025
3.0.35 93 2/21/2025
3.0.34 264 2/21/2025
3.0.33 153 2/21/2025
3.0.32 295 2/19/2025
3.0.31 394 2/18/2025
3.0.30 160 2/18/2025
3.0.29 228 2/18/2025
3.0.28 94 2/18/2025
3.0.27 317 2/14/2025
3.0.26 244 2/14/2025
3.0.25 178 2/13/2025
3.0.24 194 2/13/2025
3.0.23 303 2/12/2025
3.0.22 102 2/12/2025
3.0.21 169 2/12/2025
3.0.20 153 2/12/2025
3.0.19 219 2/11/2025
3.0.18 100 2/11/2025
3.0.17 279 2/11/2025
3.0.16 92 2/11/2025
3.0.15 155 2/11/2025
3.0.14 164 2/11/2025
3.0.13 95 2/11/2025
3.0.12 114 2/10/2025
3.0.11 99 2/10/2025
3.0.10 144 2/10/2025
3.0.9 154 2/10/2025
3.0.8 101 2/10/2025
3.0.7 99 2/10/2025
3.0.6 97 2/10/2025
3.0.5 92 2/10/2025
3.0.4 155 2/9/2025
3.0.3 222 2/9/2025
3.0.2 236 2/8/2025
3.0.1 222 2/7/2025