Soenneker.ConcurrentProcessing.Executor 3.0.139

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.139
                    
NuGet\Install-Package Soenneker.ConcurrentProcessing.Executor -Version 3.0.139
                    
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.139" />
                    
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.139" />
                    
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.139
                    
#r "nuget: Soenneker.ConcurrentProcessing.Executor, 3.0.139"
                    
#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.139
                    
Install Soenneker.ConcurrentProcessing.Executor as a Cake Addin
#tool nuget:?package=Soenneker.ConcurrentProcessing.Executor&version=3.0.139
                    
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.145 84 a day ago
3.0.144 35 2 days ago
3.0.143 26 2 days ago
3.0.142 28 2 days ago
3.0.141 30 2 days ago
3.0.140 399 2 days ago
3.0.139 1,296 a month ago
3.0.138 183 a month ago
3.0.137 148 a month ago
3.0.136 143 a month ago
3.0.135 141 a month ago
3.0.134 140 a month ago
3.0.133 141 a month ago
3.0.132 445 a month ago
3.0.131 280 a month ago
3.0.130 239 a month ago
3.0.129 331 a month ago
3.0.128 304 a month ago
3.0.127 255 a month ago
3.0.126 231 a month ago
3.0.125 405 a month ago
3.0.124 238 a month ago
3.0.123 351 a month ago
3.0.122 174 a month ago
3.0.121 131 a month ago
3.0.120 139 a month ago
3.0.119 130 a month ago
3.0.118 135 a month ago
3.0.117 155 a month ago
3.0.116 119 a month ago
3.0.115 112 a month ago
3.0.114 90 a month ago
3.0.113 78 a month ago
3.0.112 76 a month ago
3.0.111 96 a month ago
3.0.110 86 a month ago
3.0.109 85 a month ago
3.0.108 85 a month ago
3.0.107 62 a month ago
3.0.106 70 a month ago
3.0.105 71 a month ago
3.0.104 73 a month ago
3.0.103 68 a month ago
3.0.102 71 a month ago
3.0.101 76 a month ago
3.0.100 76 a month ago
3.0.99 69 a month ago
3.0.98 82 a month ago
3.0.97 1,961 a month ago
3.0.96 407 a month ago
3.0.95 256 a month ago
3.0.94 179 a month ago
3.0.93 380 a month ago
3.0.92 183 a month ago
3.0.91 336 a month ago
3.0.90 209 a month ago
3.0.89 197 a month ago
3.0.88 78 a month ago
3.0.87 115 a month ago
3.0.86 698 a month ago
3.0.85 513 a month ago
3.0.84 176 2 months ago
3.0.83 204 2 months ago
3.0.82 311 2 months ago
3.0.81 225 2 months ago
3.0.80 214 2 months ago
3.0.79 105 2 months ago
3.0.78 234 2 months ago
3.0.77 152 2 months ago
3.0.76 145 2 months ago
3.0.75 155 2 months ago
3.0.74 149 2 months ago
3.0.73 161 2 months ago
3.0.72 151 2 months ago
3.0.71 388 2 months ago
3.0.70 250 2 months ago
3.0.69 212 2 months ago
3.0.68 147 2 months ago
3.0.67 224 2 months ago
3.0.66 334 2 months ago
3.0.65 251 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 286 2 months ago
3.0.48 137 2 months ago
3.0.47 140 2 months ago
3.0.46 149 2 months ago
3.0.45 88 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 243 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 3 months ago
3.0.33 152 3 months ago
3.0.32 294 3 months ago
3.0.31 392 3 months ago
3.0.30 159 3 months ago
3.0.29 227 3 months ago
3.0.28 93 3 months ago
3.0.27 316 3 months ago
3.0.26 243 3 months ago
3.0.25 177 3 months ago
3.0.24 193 3 months ago
3.0.23 302 3 months ago
3.0.22 100 3 months ago
3.0.21 168 3 months ago
3.0.20 152 3 months ago
3.0.19 217 3 months ago
3.0.18 99 3 months ago
3.0.17 278 3 months ago
3.0.16 91 3 months ago
3.0.15 154 3 months ago
3.0.14 162 3 months ago
3.0.13 94 3 months ago
3.0.12 113 3 months ago
3.0.11 98 3 months ago
3.0.10 143 3 months ago
3.0.9 153 3 months ago
3.0.8 100 3 months ago
3.0.7 98 3 months ago
3.0.6 96 3 months ago
3.0.5 91 3 months ago
3.0.4 153 3 months ago
3.0.3 220 3 months ago
3.0.2 234 3 months ago
3.0.1 221 3 months ago