Soenneker.ConcurrentProcessing.Executor 3.0.106

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.106
                    
NuGet\Install-Package Soenneker.ConcurrentProcessing.Executor -Version 3.0.106
                    
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.106" />
                    
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.106" />
                    
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.106
                    
#r "nuget: Soenneker.ConcurrentProcessing.Executor, 3.0.106"
                    
#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.106
                    
Install Soenneker.ConcurrentProcessing.Executor as a Cake Addin
#tool nuget:?package=Soenneker.ConcurrentProcessing.Executor&version=3.0.106
                    
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.159 243 2 days ago
3.0.158 101 2 days ago
3.0.157 50 2 days ago
3.0.156 113 2 days ago
3.0.155 762 7 days ago
3.0.154 198 7 days ago
3.0.153 121 7 days ago
3.0.152 164 7 days ago
3.0.151 598 16 days ago
3.0.150 264 16 days ago
3.0.149 674 22 days ago
3.0.148 186 22 days ago
3.0.147 125 22 days ago
3.0.146 129 22 days ago
3.0.145 385 24 days ago
3.0.144 131 25 days ago
3.0.143 122 25 days ago
3.0.142 124 25 days ago
3.0.141 127 25 days ago
3.0.140 547 25 days ago
3.0.139 1,330 2 months ago
3.0.138 188 2 months ago
3.0.137 152 2 months ago
3.0.136 147 2 months ago
3.0.135 145 2 months ago
3.0.134 145 2 months ago
3.0.133 145 2 months ago
3.0.132 451 2 months ago
3.0.131 284 2 months ago
3.0.130 243 2 months ago
3.0.129 335 2 months ago
3.0.128 308 2 months ago
3.0.127 259 2 months ago
3.0.126 235 2 months ago
3.0.125 409 2 months ago
3.0.124 249 2 months ago
3.0.123 357 2 months ago
3.0.122 180 2 months ago
3.0.121 135 2 months ago
3.0.120 143 2 months ago
3.0.119 134 2 months ago
3.0.118 140 2 months ago
3.0.117 159 2 months ago
3.0.116 123 2 months ago
3.0.115 120 2 months ago
3.0.114 93 2 months ago
3.0.113 81 2 months ago
3.0.112 79 2 months ago
3.0.111 99 2 months ago
3.0.110 89 2 months ago
3.0.109 88 2 months ago
3.0.108 89 2 months ago
3.0.107 65 2 months ago
3.0.106 74 2 months ago
3.0.105 74 2 months ago
3.0.104 76 2 months ago
3.0.103 71 2 months ago
3.0.102 74 2 months ago
3.0.101 79 2 months ago
3.0.100 79 2 months ago
3.0.99 73 2 months ago
3.0.98 85 2 months ago
3.0.97 1,964 2 months ago
3.0.96 411 2 months ago
3.0.95 260 2 months ago
3.0.94 182 2 months ago
3.0.93 386 2 months ago
3.0.92 186 2 months ago
3.0.91 340 2 months ago
3.0.90 212 2 months ago
3.0.89 202 2 months ago
3.0.88 83 2 months ago
3.0.87 122 2 months ago
3.0.86 701 2 months ago
3.0.85 516 2 months ago
3.0.84 185 2 months ago
3.0.83 210 2 months ago
3.0.82 316 2 months ago
3.0.81 230 2 months ago
3.0.80 217 2 months ago
3.0.79 109 2 months ago
3.0.78 239 3 months ago
3.0.77 156 3 months ago
3.0.76 149 3 months ago
3.0.75 158 3 months ago
3.0.74 154 3 months ago
3.0.73 164 3 months ago
3.0.72 156 3 months ago
3.0.71 393 3 months ago
3.0.70 253 3 months ago
3.0.69 216 3 months ago
3.0.68 151 3 months ago
3.0.67 229 3 months ago
3.0.66 338 3 months ago
3.0.65 255 3 months ago
3.0.64 366 3 months ago
3.0.63 217 3 months ago
3.0.62 93 3 months ago
3.0.61 149 3 months ago
3.0.60 144 3 months ago
3.0.59 187 3 months ago
3.0.58 91 3 months ago
3.0.57 134 3 months ago
3.0.56 221 3 months ago
3.0.55 84 3 months ago
3.0.54 86 3 months ago
3.0.53 88 3 months ago
3.0.52 84 3 months ago
3.0.51 166 3 months ago
3.0.50 94 3 months ago
3.0.49 291 3 months ago
3.0.48 142 3 months ago
3.0.47 145 3 months ago
3.0.46 154 3 months ago
3.0.45 93 3 months ago
3.0.44 190 3 months ago
3.0.43 164 3 months ago
3.0.42 85 3 months ago
3.0.41 266 3 months ago
3.0.40 246 3 months ago
3.0.39 190 3 months ago
3.0.38 117 3 months ago
3.0.37 152 3 months ago
3.0.36 168 3 months ago
3.0.35 95 3 months ago
3.0.34 266 3 months ago
3.0.33 155 3 months ago
3.0.32 298 3 months ago
3.0.31 396 3 months ago
3.0.30 162 3 months ago
3.0.29 230 3 months ago
3.0.28 96 3 months ago
3.0.27 319 4 months ago
3.0.26 246 4 months ago
3.0.25 180 4 months ago
3.0.24 196 4 months ago
3.0.23 305 4 months ago
3.0.22 104 4 months ago
3.0.21 171 4 months ago
3.0.20 155 4 months ago
3.0.19 221 4 months ago
3.0.18 102 4 months ago
3.0.17 281 4 months ago
3.0.16 94 4 months ago
3.0.15 157 4 months ago
3.0.14 166 4 months ago
3.0.13 97 4 months ago
3.0.12 117 4 months ago
3.0.11 102 4 months ago
3.0.10 146 4 months ago
3.0.9 156 4 months ago
3.0.8 103 4 months ago
3.0.7 101 4 months ago
3.0.6 99 4 months ago
3.0.5 94 4 months ago
3.0.4 157 4 months ago
3.0.3 224 4 months ago
3.0.2 238 4 months ago
3.0.1 226 4 months ago