DispatchSharp 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package DispatchSharp --version 1.0.0
NuGet\Install-Package DispatchSharp -Version 1.0.0
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="DispatchSharp" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DispatchSharp --version 1.0.0
#r "nuget: DispatchSharp, 1.0.0"
#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.
// Install DispatchSharp as a Cake Addin
#addin nuget:?package=DispatchSharp&version=1.0.0

// Install DispatchSharp as a Cake Tool
#tool nuget:?package=DispatchSharp&version=1.0.0

DispatchSharp

https://www.nuget.org/packages/DispatchSharp/

A library to make multi-threaded dispatch code more testable.

Models a job dispatch pattern and provides both threaded and non threaded implementations.

Getting Started

Doing a batch of work:

void DoBatch(IEnumerable<object> workToDo) {
	var dispatcher = Dispatch<object>.CreateDefaultMultithreaded("MyTask");

	dispatcher.AddConsumer(MyWorkMethod);
	dispatcher.Start();
	dispatcher.AddWork(workToDo);
	dispatcher.WaitForEmptyQueueAndStop();	// only call this if you're not filling the queue from elsewhere
}

or

Dispatch<int>.ProcessBatch("BatchRequests", Enumerable.Range(0, times).ToArray(), i => {
        . . .
    },
    threadCount,
    ex => {
        Console.WriteLine("Error: " + ex.Message);
    }
);

Handling long running incoming jobs:

dispatcher = Dispatch<object>.CreateDefaultMultithreaded("MyService");
dispatcher.AddConsumer(MyWorkMethod);
dispatcher.Start();
.
.
.
dispatcher.AddWork(...);

Using a polling method to handle incoming jobs in a long-running process:

var dispatcher = Dispatch<object>.PollAndProces("MyService", myPollingSource);
dispatcher.AddConsumer(MyWorkMethod);
dispatcher.Start();

with a method defined like

void MyWorkMethod(object obj)
{
	. . .
}
Product Compatible and additional computed target framework versions.
.NET Framework net40 is compatible.  net403 was computed.  net45 was computed.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on DispatchSharp:

Package Downloads
SevenDigital.Messaging

A distributed contracts-based sender/handler messaging system built on RabbitMQ and BearBones-Messaging

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.5.0 305 6/12/2023
1.4.0 158 5/26/2023
1.3.0 177 5/10/2023
1.2.2 186 4/25/2023
1.2.1 198 4/13/2023
1.2.0 196 4/13/2023
1.1.3 306 2/1/2023
1.1.2 365 11/2/2022
1.1.0 364 11/1/2022
1.0.0 3,148 8/10/2018
0.1.11 2,848 12/6/2013
0.1.10 1,312 8/19/2013
0.1.9 1,561 7/18/2013
0.1.8 1,444 7/9/2013
0.1.7 1,393 6/19/2013
0.1.6 1,381 6/17/2013
0.1.5 1,350 6/10/2013
0.1.4 1,307 6/6/2013
0.1.3 1,324 6/6/2013
0.1.2 1,309 6/4/2013
0.1.1 1,303 6/4/2013
0.1.0 1,375 5/31/2013
0.0.1 1,364 5/21/2013