Soenneker.ConcurrentProcessing.Executor 3.0.128

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.128
                    
NuGet\Install-Package Soenneker.ConcurrentProcessing.Executor -Version 3.0.128
                    
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.128" />
                    
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.128" />
                    
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.128
                    
#r "nuget: Soenneker.ConcurrentProcessing.Executor, 3.0.128"
                    
#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.128
                    
Install Soenneker.ConcurrentProcessing.Executor as a Cake Addin
#tool nuget:?package=Soenneker.ConcurrentProcessing.Executor&version=3.0.128
                    
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 431 3 days ago
3.0.138 137 3 days ago
3.0.137 102 3 days ago
3.0.136 97 3 days ago
3.0.135 92 3 days ago
3.0.134 94 3 days ago
3.0.133 89 3 days ago
3.0.132 371 3 days ago
3.0.131 221 3 days ago
3.0.130 185 4 days ago
3.0.129 285 4 days ago
3.0.128 254 4 days ago
3.0.127 206 4 days ago
3.0.126 183 4 days ago
3.0.125 360 4 days ago
3.0.124 191 4 days ago
3.0.123 303 4 days ago
3.0.122 126 5 days ago
3.0.121 86 5 days ago
3.0.120 94 5 days ago
3.0.119 85 5 days ago
3.0.118 88 5 days ago
3.0.117 106 5 days ago
3.0.116 98 5 days ago
3.0.115 91 5 days ago
3.0.114 86 6 days ago
3.0.113 75 6 days ago
3.0.112 72 6 days ago
3.0.111 92 6 days ago
3.0.110 83 6 days ago
3.0.109 79 6 days ago
3.0.108 83 6 days ago
3.0.107 59 6 days ago
3.0.106 65 6 days ago
3.0.105 65 6 days ago
3.0.104 70 6 days ago
3.0.103 61 7 days ago
3.0.102 67 7 days ago
3.0.101 70 7 days ago
3.0.100 76 7 days ago
3.0.99 68 7 days ago
3.0.98 80 7 days ago
3.0.97 1,954 8 days ago
3.0.96 405 10 days ago
3.0.95 251 10 days ago
3.0.94 176 10 days ago
3.0.93 380 11 days ago
3.0.92 183 11 days ago
3.0.91 336 11 days ago
3.0.90 209 11 days ago
3.0.89 197 13 days ago
3.0.88 77 13 days ago
3.0.87 115 13 days ago
3.0.86 690 17 days ago
3.0.85 509 17 days ago
3.0.84 172 21 days ago
3.0.83 204 22 days ago
3.0.82 306 24 days ago
3.0.81 225 25 days 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 330 a month ago
3.0.65 250 a month ago
3.0.64 361 a month ago
3.0.63 213 a month ago
3.0.62 89 a month ago
3.0.61 144 a month ago
3.0.60 140 a month ago
3.0.59 182 a month ago
3.0.58 86 a month ago
3.0.57 128 a month ago
3.0.56 215 a month ago
3.0.55 78 a month ago
3.0.54 80 a month ago
3.0.53 75 a month ago
3.0.52 79 a month ago
3.0.51 161 a month ago
3.0.50 88 a month 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 80 2 months ago
3.0.41 259 2 months ago
3.0.40 240 2 months ago
3.0.39 185 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 2 months ago