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.
#addin nuget:?package=Soenneker.ConcurrentProcessing.Executor&version=3.0.157
                    
Install Soenneker.ConcurrentProcessing.Executor as a Cake Addin
#tool nuget:?package=Soenneker.ConcurrentProcessing.Executor&version=3.0.157
                    
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.163 721 10 days ago
3.0.162 350 11 days ago
3.0.161 305 11 days ago
3.0.160 346 18 days ago
3.0.159 592 25 days ago
3.0.158 191 25 days ago
3.0.157 132 25 days ago
3.0.156 195 25 days ago
3.0.155 786 a month ago
3.0.154 205 a month ago
3.0.153 129 a month ago
3.0.152 171 a month ago
3.0.151 608 a month ago
3.0.150 268 a month ago
3.0.149 679 a month ago
3.0.148 192 a month ago
3.0.147 130 a month ago
3.0.146 133 a month ago
3.0.145 392 2 months ago
3.0.144 135 2 months ago
3.0.143 126 2 months ago
3.0.142 130 2 months ago
3.0.141 133 2 months ago
3.0.140 551 2 months ago
3.0.139 1,335 2 months ago
3.0.138 191 2 months ago
3.0.137 155 2 months ago
3.0.136 150 2 months ago
3.0.135 148 2 months ago
3.0.134 149 2 months ago
3.0.133 148 2 months ago
3.0.132 454 2 months ago
3.0.131 287 2 months ago
3.0.130 246 2 months ago
3.0.129 338 2 months ago
3.0.128 311 2 months ago
3.0.127 262 2 months ago
3.0.126 245 2 months ago
3.0.125 414 2 months ago
3.0.124 252 2 months ago
3.0.123 363 2 months ago
3.0.122 183 2 months ago
3.0.121 138 2 months ago
3.0.120 146 2 months ago
3.0.119 138 2 months ago
3.0.118 143 2 months ago
3.0.117 162 2 months ago
3.0.116 127 2 months ago
3.0.115 123 2 months ago
3.0.114 96 2 months ago
3.0.113 84 3 months ago
3.0.112 82 3 months ago
3.0.111 102 3 months ago
3.0.110 92 3 months ago
3.0.109 91 3 months ago
3.0.108 92 3 months ago
3.0.107 68 3 months ago
3.0.106 78 3 months ago
3.0.105 78 3 months ago
3.0.104 80 3 months ago
3.0.103 74 3 months ago
3.0.102 77 3 months ago
3.0.101 82 3 months ago
3.0.100 83 3 months ago
3.0.99 77 3 months ago
3.0.98 89 3 months ago
3.0.97 1,968 3 months ago
3.0.96 415 3 months ago
3.0.95 263 3 months ago
3.0.94 187 3 months ago
3.0.93 391 3 months ago
3.0.92 189 3 months ago
3.0.91 343 3 months ago
3.0.90 215 3 months ago
3.0.89 205 3 months ago
3.0.88 86 3 months ago
3.0.87 124 3 months ago
3.0.86 705 3 months ago
3.0.85 518 3 months ago
3.0.84 188 3 months ago
3.0.83 213 3 months ago
3.0.82 318 3 months ago
3.0.81 232 3 months ago
3.0.80 220 3 months ago
3.0.79 111 3 months ago
3.0.78 241 3 months ago
3.0.77 158 3 months ago
3.0.76 151 3 months ago
3.0.75 160 3 months ago
3.0.74 156 3 months ago
3.0.73 166 3 months ago
3.0.72 158 3 months ago
3.0.71 395 3 months ago
3.0.70 255 3 months ago
3.0.69 218 3 months ago
3.0.68 153 3 months ago
3.0.67 231 3 months ago
3.0.66 342 3 months ago
3.0.65 258 3 months ago
3.0.64 370 4 months ago
3.0.63 222 4 months ago
3.0.62 96 4 months ago
3.0.61 152 4 months ago
3.0.60 147 4 months ago
3.0.59 190 4 months ago
3.0.58 94 4 months ago
3.0.57 138 4 months ago
3.0.56 224 4 months ago
3.0.55 87 4 months ago
3.0.54 89 4 months ago
3.0.53 90 4 months ago
3.0.52 86 4 months ago
3.0.51 169 4 months ago
3.0.50 96 4 months ago
3.0.49 293 4 months ago
3.0.48 144 4 months ago
3.0.47 147 4 months ago
3.0.46 157 4 months ago
3.0.45 95 4 months ago
3.0.44 192 4 months ago
3.0.43 166 4 months ago
3.0.42 87 4 months ago
3.0.41 271 4 months ago
3.0.40 248 4 months ago
3.0.39 192 4 months ago
3.0.38 119 4 months ago
3.0.37 154 4 months ago
3.0.36 171 4 months ago
3.0.35 97 4 months ago
3.0.34 268 4 months ago
3.0.33 157 4 months ago
3.0.32 301 4 months ago
3.0.31 398 4 months ago
3.0.30 164 4 months ago
3.0.29 232 4 months ago
3.0.28 98 4 months ago
3.0.27 323 4 months ago
3.0.26 249 4 months ago
3.0.25 183 4 months ago
3.0.24 207 4 months ago
3.0.23 310 4 months ago
3.0.22 106 4 months ago
3.0.21 175 4 months ago
3.0.20 157 4 months ago
3.0.19 223 4 months ago
3.0.18 104 4 months ago
3.0.17 284 4 months ago
3.0.16 96 4 months ago
3.0.15 160 4 months ago
3.0.14 168 4 months ago
3.0.13 99 4 months ago
3.0.12 119 4 months ago
3.0.11 104 4 months ago
3.0.10 148 4 months ago
3.0.9 158 4 months ago
3.0.8 105 4 months ago
3.0.7 103 4 months ago
3.0.6 102 4 months ago
3.0.5 96 4 months ago
3.0.4 161 4 months ago
3.0.3 227 4 months ago
3.0.2 240 4 months ago
3.0.1 230 4 months ago