Soenneker.ConcurrentProcessing.Executor 3.0.39

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.39
                    
NuGet\Install-Package Soenneker.ConcurrentProcessing.Executor -Version 3.0.39
                    
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.39" />
                    
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.39" />
                    
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.39
                    
#r "nuget: Soenneker.ConcurrentProcessing.Executor, 3.0.39"
                    
#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.39
                    
Install Soenneker.ConcurrentProcessing.Executor as a Cake Addin
#tool nuget:?package=Soenneker.ConcurrentProcessing.Executor&version=3.0.39
                    
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. 
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.139 736 14 days ago
3.0.138 183 14 days ago
3.0.137 148 14 days ago
3.0.136 143 14 days ago
3.0.135 138 14 days ago
3.0.134 139 14 days ago
3.0.133 138 14 days ago
3.0.132 443 14 days ago
3.0.131 278 15 days ago
3.0.130 238 15 days ago
3.0.129 330 15 days ago
3.0.128 303 15 days ago
3.0.127 253 15 days ago
3.0.126 230 15 days ago
3.0.125 404 15 days ago
3.0.124 238 15 days ago
3.0.123 350 16 days ago
3.0.122 173 16 days ago
3.0.121 131 16 days ago
3.0.120 139 16 days ago
3.0.119 130 16 days ago
3.0.118 135 16 days ago
3.0.117 155 16 days ago
3.0.116 119 16 days ago
3.0.115 112 17 days ago
3.0.114 89 17 days ago
3.0.113 78 17 days ago
3.0.112 76 17 days ago
3.0.111 95 17 days ago
3.0.110 86 17 days ago
3.0.109 85 17 days ago
3.0.108 85 17 days ago
3.0.107 62 17 days ago
3.0.106 70 17 days ago
3.0.105 70 17 days ago
3.0.104 72 18 days ago
3.0.103 67 18 days ago
3.0.102 71 18 days ago
3.0.101 76 18 days ago
3.0.100 76 18 days ago
3.0.99 69 18 days ago
3.0.98 82 18 days ago
3.0.97 1,956 19 days ago
3.0.96 407 21 days ago
3.0.95 255 21 days ago
3.0.94 179 21 days ago
3.0.93 380 22 days ago
3.0.92 183 22 days ago
3.0.91 336 22 days ago
3.0.90 209 22 days ago
3.0.89 197 24 days ago
3.0.88 77 24 days ago
3.0.87 115 24 days ago
3.0.86 690 a month ago
3.0.85 509 a month ago
3.0.84 176 a month ago
3.0.83 204 a month ago
3.0.82 306 a month ago
3.0.81 225 a month ago
3.0.80 214 a month ago
3.0.79 105 a month ago
3.0.78 234 a month ago
3.0.77 152 a month ago
3.0.76 145 a month ago
3.0.75 155 a month ago
3.0.74 149 a month ago
3.0.73 161 a month ago
3.0.72 151 a month ago
3.0.71 388 a month ago
3.0.70 250 a month ago
3.0.69 212 a month ago
3.0.68 147 a month ago
3.0.67 224 a month ago
3.0.66 334 2 months ago
3.0.65 250 2 months ago
3.0.64 361 2 months ago
3.0.63 213 2 months ago
3.0.62 89 2 months ago
3.0.61 144 2 months ago
3.0.60 140 2 months ago
3.0.59 182 2 months ago
3.0.58 86 2 months ago
3.0.57 128 2 months ago
3.0.56 215 2 months ago
3.0.55 78 2 months ago
3.0.54 80 2 months ago
3.0.53 75 2 months ago
3.0.52 79 2 months ago
3.0.51 161 2 months ago
3.0.50 88 2 months ago
3.0.49 282 2 months ago
3.0.48 136 2 months ago
3.0.47 139 2 months ago
3.0.46 149 2 months ago
3.0.45 87 2 months ago
3.0.44 185 2 months ago
3.0.43 159 2 months ago
3.0.42 81 2 months ago
3.0.41 260 2 months ago
3.0.40 241 2 months ago
3.0.39 186 2 months ago
3.0.38 114 2 months ago
3.0.37 149 2 months ago
3.0.36 165 2 months ago
3.0.35 91 2 months ago
3.0.34 263 2 months ago
3.0.33 152 2 months ago
3.0.32 294 2 months ago
3.0.31 392 2 months ago
3.0.30 158 2 months ago
3.0.29 227 2 months ago
3.0.28 93 2 months ago
3.0.27 316 2 months ago
3.0.26 242 2 months ago
3.0.25 177 2 months ago
3.0.24 193 2 months ago
3.0.23 302 2 months ago
3.0.22 100 2 months ago
3.0.21 168 2 months ago
3.0.20 152 2 months ago
3.0.19 217 2 months ago
3.0.18 99 2 months ago
3.0.17 278 2 months ago
3.0.16 91 2 months ago
3.0.15 154 2 months ago
3.0.14 162 2 months ago
3.0.13 94 2 months ago
3.0.12 113 2 months ago
3.0.11 98 2 months ago
3.0.10 143 2 months ago
3.0.9 153 2 months ago
3.0.8 100 2 months ago
3.0.7 98 2 months ago
3.0.6 96 2 months ago
3.0.5 91 2 months ago
3.0.4 153 2 months ago
3.0.3 220 2 months ago
3.0.2 234 2 months ago
3.0.1 221 3 months ago