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.  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.155 104 a day ago
3.0.154 95 a day ago
3.0.153 54 a day ago
3.0.152 76 a day ago
3.0.151 576 10 days ago
3.0.150 263 10 days ago
3.0.149 672 16 days ago
3.0.148 184 16 days ago
3.0.147 123 16 days ago
3.0.146 127 16 days ago
3.0.145 383 18 days ago
3.0.144 129 19 days ago
3.0.143 120 19 days ago
3.0.142 122 19 days ago
3.0.141 125 19 days ago
3.0.140 544 19 days ago
3.0.139 1,327 a month ago
3.0.138 187 a month ago
3.0.137 151 2 months ago
3.0.136 146 2 months ago
3.0.135 144 2 months ago
3.0.134 144 2 months ago
3.0.133 144 2 months ago
3.0.132 450 2 months ago
3.0.131 283 2 months ago
3.0.130 242 2 months ago
3.0.129 334 2 months ago
3.0.128 307 2 months ago
3.0.127 258 2 months ago
3.0.126 234 2 months ago
3.0.125 408 2 months ago
3.0.124 248 2 months ago
3.0.123 355 2 months ago
3.0.122 177 2 months ago
3.0.121 134 2 months ago
3.0.120 142 2 months ago
3.0.119 133 2 months ago
3.0.118 139 2 months ago
3.0.117 158 2 months ago
3.0.116 122 2 months ago
3.0.115 119 2 months ago
3.0.114 92 2 months ago
3.0.113 80 2 months ago
3.0.112 78 2 months ago
3.0.111 98 2 months ago
3.0.110 88 2 months ago
3.0.109 87 2 months ago
3.0.108 88 2 months ago
3.0.107 64 2 months ago
3.0.106 73 2 months ago
3.0.105 73 2 months ago
3.0.104 75 2 months ago
3.0.103 70 2 months ago
3.0.102 73 2 months ago
3.0.101 78 2 months ago
3.0.100 78 2 months ago
3.0.99 72 2 months ago
3.0.98 84 2 months ago
3.0.97 1,963 2 months ago
3.0.96 410 2 months ago
3.0.95 259 2 months ago
3.0.94 181 2 months ago
3.0.93 384 2 months ago
3.0.92 185 2 months ago
3.0.91 338 2 months ago
3.0.90 211 2 months ago
3.0.89 201 2 months ago
3.0.88 82 2 months ago
3.0.87 119 2 months ago
3.0.86 700 2 months ago
3.0.85 515 2 months ago
3.0.84 178 2 months ago
3.0.83 206 2 months ago
3.0.82 313 2 months ago
3.0.81 229 2 months ago
3.0.80 216 2 months ago
3.0.79 108 2 months ago
3.0.78 236 2 months ago
3.0.77 154 2 months ago
3.0.76 148 2 months ago
3.0.75 157 2 months ago
3.0.74 151 2 months ago
3.0.73 163 2 months ago
3.0.72 154 2 months ago
3.0.71 392 2 months ago
3.0.70 252 2 months ago
3.0.69 215 2 months ago
3.0.68 150 2 months ago
3.0.67 227 2 months ago
3.0.66 337 3 months ago
3.0.65 254 3 months ago
3.0.64 364 3 months ago
3.0.63 216 3 months ago
3.0.62 92 3 months ago
3.0.61 148 3 months ago
3.0.60 143 3 months ago
3.0.59 185 3 months ago
3.0.58 89 3 months ago
3.0.57 131 3 months ago
3.0.56 219 3 months ago
3.0.55 82 3 months ago
3.0.54 84 3 months ago
3.0.53 85 3 months ago
3.0.52 83 3 months ago
3.0.51 165 3 months ago
3.0.50 93 3 months ago
3.0.49 290 3 months ago
3.0.48 141 3 months ago
3.0.47 144 3 months ago
3.0.46 153 3 months ago
3.0.45 92 3 months ago
3.0.44 189 3 months ago
3.0.43 163 3 months ago
3.0.42 84 3 months ago
3.0.41 263 3 months ago
3.0.40 245 3 months ago
3.0.39 189 3 months ago
3.0.38 116 3 months ago
3.0.37 151 3 months ago
3.0.36 167 3 months ago
3.0.35 94 3 months ago
3.0.34 265 3 months ago
3.0.33 154 3 months ago
3.0.32 296 3 months ago
3.0.31 395 3 months ago
3.0.30 161 3 months ago
3.0.29 229 3 months ago
3.0.28 95 3 months ago
3.0.27 318 3 months ago
3.0.26 245 3 months ago
3.0.25 179 3 months ago
3.0.24 195 3 months ago
3.0.23 304 3 months ago
3.0.22 103 3 months ago
3.0.21 170 3 months ago
3.0.20 154 3 months ago
3.0.19 220 3 months ago
3.0.18 101 3 months ago
3.0.17 280 3 months ago
3.0.16 93 3 months ago
3.0.15 156 3 months ago
3.0.14 165 3 months ago
3.0.13 96 3 months ago
3.0.12 115 3 months ago
3.0.11 100 3 months ago
3.0.10 145 3 months ago
3.0.9 155 3 months ago
3.0.8 102 3 months ago
3.0.7 100 3 months ago
3.0.6 98 3 months ago
3.0.5 93 3 months ago
3.0.4 156 3 months ago
3.0.3 223 3 months ago
3.0.2 237 4 months ago
3.0.1 225 4 months ago