Soenneker.ConcurrentProcessing.Executor 3.0.161

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.161
                    
NuGet\Install-Package Soenneker.ConcurrentProcessing.Executor -Version 3.0.161
                    
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.161" />
                    
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.161" />
                    
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.161
                    
#r "nuget: Soenneker.ConcurrentProcessing.Executor, 3.0.161"
                    
#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@3.0.161
                    
#: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=3.0.161
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.ConcurrentProcessing.Executor&version=3.0.161
                    
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

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.191 357 12 days ago
3.0.190 261 13 days ago
3.0.189 125 13 days ago
3.0.188 171 13 days ago
3.0.187 438 19 days ago
3.0.186 132 19 days ago
3.0.185 237 20 days ago
3.0.184 135 20 days ago
3.0.183 139 20 days ago
3.0.182 141 20 days ago
3.0.181 139 20 days ago
3.0.180 364 a month ago
3.0.179 600 a month ago
3.0.178 175 a month ago
3.0.177 158 a month ago
3.0.176 126 a month ago
3.0.175 125 a month ago
3.0.174 582 2 months ago
3.0.173 258 2 months ago
3.0.172 222 2 months ago
3.0.171 821 2 months ago
3.0.170 201 2 months ago
3.0.169 241 2 months ago
3.0.168 973 3 months ago
3.0.167 181 3 months ago
3.0.166 83 3 months ago
3.0.165 79 3 months ago
3.0.164 173 3 months ago
3.0.163 1,062 3 months ago
3.0.162 366 3 months ago
3.0.161 328 3 months ago
3.0.160 362 4 months ago
3.0.159 611 4 months ago
3.0.158 213 4 months ago
3.0.157 144 4 months ago
3.0.156 207 4 months ago
3.0.155 811 4 months ago
3.0.154 221 4 months ago
3.0.153 154 4 months ago
3.0.152 192 4 months ago
3.0.151 628 4 months ago
3.0.150 282 4 months ago
3.0.149 696 4 months ago
3.0.148 209 4 months ago
3.0.147 144 4 months ago
3.0.146 150 4 months ago
3.0.145 418 5 months ago
3.0.144 154 5 months ago
3.0.143 139 5 months ago
3.0.142 141 5 months ago
3.0.141 153 5 months ago
3.0.140 570 5 months ago
3.0.139 1,355 5 months ago
3.0.138 216 5 months ago
3.0.137 177 5 months ago
3.0.136 166 5 months ago
3.0.135 169 5 months ago
3.0.134 167 5 months ago
3.0.133 164 5 months ago
3.0.132 477 5 months ago
3.0.131 309 5 months ago
3.0.130 268 5 months ago
3.0.129 356 5 months ago
3.0.128 327 5 months ago
3.0.127 287 5 months ago
3.0.126 266 5 months ago
3.0.125 435 6 months ago
3.0.124 282 6 months ago
3.0.123 378 6 months ago
3.0.122 197 6 months ago
3.0.121 161 6 months ago
3.0.120 173 6 months ago
3.0.119 154 6 months ago
3.0.118 163 6 months ago
3.0.117 179 6 months ago
3.0.116 156 6 months ago
3.0.115 149 6 months ago
3.0.114 129 6 months ago
3.0.113 105 6 months ago
3.0.112 106 6 months ago
3.0.111 126 6 months ago
3.0.110 116 6 months ago
3.0.109 116 6 months ago
3.0.108 107 6 months ago
3.0.107 80 6 months ago
3.0.106 93 6 months ago
3.0.105 94 6 months ago
3.0.104 95 6 months ago
3.0.103 89 6 months ago
3.0.102 101 6 months ago
3.0.101 98 6 months ago
3.0.100 98 6 months ago
3.0.99 95 6 months ago
3.0.98 114 6 months ago
3.0.97 1,990 6 months ago
3.0.96 434 6 months ago
3.0.95 281 6 months ago
3.0.94 202 6 months ago
3.0.93 404 6 months ago
3.0.92 204 6 months ago
3.0.91 357 6 months ago
3.0.90 235 6 months ago
3.0.89 221 6 months ago
3.0.88 99 6 months ago
3.0.87 151 6 months ago
3.0.86 727 6 months ago
3.0.85 545 6 months ago
3.0.84 217 6 months ago
3.0.83 236 6 months ago
3.0.82 341 6 months ago
3.0.81 253 6 months ago
3.0.80 233 6 months ago
3.0.79 126 6 months ago
3.0.78 263 6 months ago
3.0.77 174 6 months ago
3.0.76 175 6 months ago
3.0.75 186 6 months ago
3.0.74 182 6 months ago
3.0.73 201 6 months ago
3.0.72 197 6 months ago
3.0.71 426 6 months ago
3.0.70 278 6 months ago
3.0.69 243 6 months ago
3.0.68 171 6 months ago
3.0.67 259 6 months ago
3.0.66 359 7 months ago
3.0.65 271 7 months ago
3.0.64 387 7 months ago
3.0.63 252 7 months ago
3.0.62 122 7 months ago
3.0.61 178 7 months ago
3.0.60 164 7 months ago
3.0.59 201 7 months ago
3.0.58 110 7 months ago
3.0.57 164 7 months ago
3.0.56 247 7 months ago
3.0.55 114 7 months ago
3.0.54 102 7 months ago
3.0.53 110 7 months ago
3.0.52 101 7 months ago
3.0.51 183 7 months ago
3.0.50 106 7 months ago
3.0.49 308 7 months ago
3.0.48 158 7 months ago
3.0.47 161 7 months ago
3.0.46 181 7 months ago
3.0.45 122 7 months ago
3.0.44 218 7 months ago
3.0.43 181 7 months ago
3.0.42 117 7 months ago
3.0.41 284 7 months ago
3.0.40 264 7 months ago
3.0.39 205 7 months ago
3.0.38 131 7 months ago
3.0.37 179 7 months ago
3.0.36 196 7 months ago
3.0.35 118 7 months ago
3.0.34 284 7 months ago
3.0.33 180 7 months ago
3.0.32 318 7 months ago
3.0.31 411 7 months ago
3.0.30 185 7 months ago
3.0.29 254 7 months ago
3.0.28 123 7 months ago
3.0.27 342 7 months ago
3.0.26 260 7 months ago
3.0.25 199 7 months ago
3.0.24 220 7 months ago
3.0.23 326 7 months ago
3.0.22 117 7 months ago
3.0.21 191 7 months ago
3.0.20 180 7 months ago
3.0.19 248 7 months ago
3.0.18 132 7 months ago
3.0.17 300 7 months ago
3.0.16 115 7 months ago
3.0.15 182 7 months ago
3.0.14 181 7 months ago
3.0.13 122 7 months ago
3.0.12 131 7 months ago
3.0.11 118 7 months ago
3.0.10 163 7 months ago
3.0.9 187 7 months ago
3.0.8 119 7 months ago
3.0.7 116 7 months ago
3.0.6 129 7 months ago
3.0.5 111 7 months ago
3.0.4 173 7 months ago
3.0.3 251 7 months ago
3.0.2 261 7 months ago
3.0.1 258 8 months ago