Soenneker.ConcurrentProcessing.Executor 3.0.157

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.157
                    
NuGet\Install-Package Soenneker.ConcurrentProcessing.Executor -Version 3.0.157
                    
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.157" />
                    
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.157" />
                    
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.157
                    
#r "nuget: Soenneker.ConcurrentProcessing.Executor, 3.0.157"
                    
#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.157
                    
#: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.157
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.ConcurrentProcessing.Executor&version=3.0.157
                    
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.171 500 21 days ago
3.0.170 191 21 days ago
3.0.169 232 21 days ago
3.0.168 959 a month ago
3.0.167 172 a month ago
3.0.166 75 a month ago
3.0.165 71 a month ago
3.0.164 165 a month ago
3.0.163 1,047 2 months ago
3.0.162 359 2 months ago
3.0.161 317 2 months ago
3.0.160 355 2 months ago
3.0.159 604 2 months ago
3.0.158 200 2 months ago
3.0.157 137 2 months ago
3.0.156 201 2 months ago
3.0.155 802 2 months ago
3.0.154 216 2 months ago
3.0.153 143 2 months ago
3.0.152 179 2 months ago
3.0.151 620 3 months ago
3.0.150 275 3 months ago
3.0.149 688 3 months ago
3.0.148 199 3 months ago
3.0.147 138 3 months ago
3.0.146 143 3 months ago
3.0.145 405 3 months ago
3.0.144 146 3 months ago
3.0.143 132 3 months ago
3.0.142 136 3 months ago
3.0.141 143 3 months ago
3.0.140 559 3 months ago
3.0.139 1,347 4 months ago
3.0.138 205 4 months ago
3.0.137 168 4 months ago
3.0.136 158 4 months ago
3.0.135 158 4 months ago
3.0.134 157 4 months ago
3.0.133 156 4 months ago
3.0.132 468 4 months ago
3.0.131 298 4 months ago
3.0.130 258 4 months ago
3.0.129 348 4 months ago
3.0.128 319 4 months ago
3.0.127 275 4 months ago
3.0.126 260 4 months ago
3.0.125 425 4 months ago
3.0.124 270 4 months ago
3.0.123 372 4 months ago
3.0.122 191 4 months ago
3.0.121 151 4 months ago
3.0.120 160 4 months ago
3.0.119 148 4 months ago
3.0.118 153 4 months ago
3.0.117 173 4 months ago
3.0.116 142 4 months ago
3.0.115 137 4 months ago
3.0.114 111 4 months ago
3.0.113 94 4 months ago
3.0.112 95 4 months ago
3.0.111 114 4 months ago
3.0.110 108 4 months ago
3.0.109 106 4 months ago
3.0.108 99 4 months ago
3.0.107 74 4 months ago
3.0.106 88 4 months ago
3.0.105 87 4 months ago
3.0.104 87 4 months ago
3.0.103 82 4 months ago
3.0.102 92 4 months ago
3.0.101 92 4 months ago
3.0.100 90 4 months ago
3.0.99 88 4 months ago
3.0.98 99 4 months ago
3.0.97 1,981 4 months ago
3.0.96 424 4 months ago
3.0.95 275 4 months ago
3.0.94 196 4 months ago
3.0.93 397 4 months ago
3.0.92 197 4 months ago
3.0.91 349 4 months ago
3.0.90 226 4 months ago
3.0.89 214 4 months ago
3.0.88 93 4 months ago
3.0.87 138 4 months ago
3.0.86 716 4 months ago
3.0.85 534 4 months ago
3.0.84 204 4 months ago
3.0.83 223 4 months ago
3.0.82 332 4 months ago
3.0.81 245 4 months ago
3.0.80 227 4 months ago
3.0.79 119 4 months ago
3.0.78 253 5 months ago
3.0.77 166 5 months ago
3.0.76 162 5 months ago
3.0.75 177 5 months ago
3.0.74 166 5 months ago
3.0.73 186 5 months ago
3.0.72 170 5 months ago
3.0.71 413 5 months ago
3.0.70 266 5 months ago
3.0.69 236 5 months ago
3.0.68 163 5 months ago
3.0.67 245 5 months ago
3.0.66 353 5 months ago
3.0.65 266 5 months ago
3.0.64 380 5 months ago
3.0.63 241 5 months ago
3.0.62 108 5 months ago
3.0.61 167 5 months ago
3.0.60 156 5 months ago
3.0.59 195 5 months ago
3.0.58 105 5 months ago
3.0.57 153 5 months ago
3.0.56 236 5 months ago
3.0.55 103 5 months ago
3.0.54 98 5 months ago
3.0.53 100 5 months ago
3.0.52 95 5 months ago
3.0.51 178 5 months ago
3.0.50 102 5 months ago
3.0.49 303 5 months ago
3.0.48 154 5 months ago
3.0.47 156 5 months ago
3.0.46 170 5 months ago
3.0.45 109 5 months ago
3.0.44 208 5 months ago
3.0.43 175 5 months ago
3.0.42 104 5 months ago
3.0.41 278 5 months ago
3.0.40 258 5 months ago
3.0.39 201 5 months ago
3.0.38 126 5 months ago
3.0.37 168 5 months ago
3.0.36 184 5 months ago
3.0.35 110 5 months ago
3.0.34 276 5 months ago
3.0.33 169 5 months ago
3.0.32 314 5 months ago
3.0.31 405 5 months ago
3.0.30 176 5 months ago
3.0.29 243 5 months ago
3.0.28 110 5 months ago
3.0.27 333 6 months ago
3.0.26 255 6 months ago
3.0.25 194 6 months ago
3.0.24 213 6 months ago
3.0.23 320 6 months ago
3.0.22 112 6 months ago
3.0.21 185 6 months ago
3.0.20 170 6 months ago
3.0.19 235 6 months ago
3.0.18 119 6 months ago
3.0.17 294 6 months ago
3.0.16 106 6 months ago
3.0.15 172 6 months ago
3.0.14 175 6 months ago
3.0.13 111 6 months ago
3.0.12 125 6 months ago
3.0.11 111 6 months ago
3.0.10 155 6 months ago
3.0.9 170 6 months ago
3.0.8 112 6 months ago
3.0.7 110 6 months ago
3.0.6 118 6 months ago
3.0.5 104 6 months ago
3.0.4 168 6 months ago
3.0.3 239 6 months ago
3.0.2 251 6 months ago
3.0.1 242 6 months ago