DispatchSharp 1.0.0

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

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

Install-Package DispatchSharp -Version 1.0.0
dotnet add package DispatchSharp --version 1.0.0
<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
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

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)
{
	. . .
}

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)
{
	. . .
}

Dependencies

This package has no dependencies.

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.0.0 204 8/10/2018
0.1.11 994 12/6/2013
0.1.10 493 8/19/2013
0.1.9 416 7/18/2013
0.1.8 431 7/9/2013
0.1.7 452 6/19/2013
0.1.6 440 6/17/2013
0.1.5 456 6/10/2013
0.1.4 425 6/6/2013
0.1.3 423 6/6/2013
0.1.2 429 6/4/2013
0.1.1 422 6/4/2013
0.1.0 485 5/31/2013
0.0.1 520 5/21/2013