Soenneker.ConcurrentProcessing.Executor 3.0.139

Prefix Reserved
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.139 672 9 days ago
3.0.138 180 9 days ago
3.0.137 145 9 days ago
3.0.136 140 9 days ago
3.0.135 135 9 days ago
3.0.134 137 9 days ago
3.0.133 134 9 days ago
3.0.132 439 9 days ago
3.0.131 278 10 days ago
3.0.130 236 10 days ago
3.0.129 328 10 days ago
3.0.128 299 10 days ago
3.0.127 249 10 days ago
3.0.126 228 10 days ago
3.0.125 403 10 days ago
3.0.124 236 10 days ago
3.0.123 346 11 days ago
3.0.122 169 11 days ago
3.0.121 129 11 days ago
3.0.120 137 11 days ago
3.0.119 128 11 days ago
3.0.118 131 11 days ago
3.0.117 151 11 days ago
3.0.116 117 11 days ago
3.0.115 110 12 days ago
3.0.114 87 12 days ago
3.0.113 78 12 days ago
3.0.112 76 12 days ago
3.0.111 95 12 days ago
3.0.110 86 12 days ago
3.0.109 85 12 days ago
3.0.108 85 12 days ago
3.0.107 62 12 days ago
3.0.106 70 12 days ago
3.0.105 70 12 days ago
3.0.104 72 13 days ago
3.0.103 65 13 days ago
3.0.102 69 13 days ago
3.0.101 74 13 days ago
3.0.100 76 13 days ago
3.0.99 69 13 days ago
3.0.98 82 13 days ago
3.0.97 1,954 14 days ago
3.0.96 407 16 days ago
3.0.95 253 16 days ago
3.0.94 179 16 days ago
3.0.93 380 17 days ago
3.0.92 183 17 days ago
3.0.91 336 17 days ago
3.0.90 209 17 days ago
3.0.89 197 19 days ago
3.0.88 77 19 days ago
3.0.87 115 19 days ago
3.0.86 690 23 days ago
3.0.85 509 23 days 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 a month ago
3.0.65 250 a month 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 2 months ago