DispatchR 1.0.1
dotnet add package DispatchR --version 1.0.1
NuGet\Install-Package DispatchR -Version 1.0.1
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="DispatchR" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DispatchR --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: DispatchR, 1.0.1"
#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 DispatchR as a Cake Addin
#addin nuget:?package=DispatchR&version=1.0.1
// Install DispatchR as a Cake Tool
#tool nuget:?package=DispatchR&version=1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
DispatchR
DispatchR is a lightweight and performant C# .NET library that dispatches asynchronous functions in order at a specified frequency or date time.
main:
Give a Star! ⭐
If you like or are using this project please give it a star. Thanks!
At Specified Time Example
Dispatcher dispatcher = new Dispatcher(new Dispatchee2((token) =>
{
return MethodAsync(token); // Make some asynchronous call.
}, DispatchTime.AtMinute(1))); // Will execute at the first minute of every hour.
dispatcher.RunAsync(token); // Run the dispatcher until the CancellationTokenSource is cancelled.
At Specified Frequency Example
Dispatcher dispatcher = new Dispatcher(new Dispatchee2((token) =>
{
return MethodAsync(token); // Make some asynchronous call.
}, DispatchTime.AtFrequency(TimeSpan.FromSeconds(10)))); // Will execute every 10 seconds.
dispatcher.RunAsync(token); // Run the dispatcher until the CancellationTokenSource is cancelled.
Multiple Dispatchees Example
Dispatcher dispatcher = new Dispatcher(new Dispatchee[]
{
new Dispatchee1((token) =>
{
return MethodAsync(token); // Make some asynchronous call.
}, DispatchTime.AtMinute(1)), // Will execute on the first minute of every hour.
new Dispatchee2((token) =>
{
return MethodAsync(token); // Make some asynchronous call
}, DispatchTime.AtFrequency(TimeSpan.FromSeconds(10))) // Will execute every 10 seconds.
});
dispatcher.RunAsync(token); // Run the dispatcher until the CancellationTokenSource is cancelled.
Order Dispatchee Execution Example
// Will execute Dispatchee1 first.
[DispatchOrder(1)]
public class Dispatchee1 : Dispatchee
{
private readonly Func<CancellationToken, Task> _func;
public MockDispatchee1(Func<CancellationToken, Task> func, DispatchTime dispatchTime) : base(dispatchTime)
{
_func = func;
}
public override Task ExecuteAsync(CancellationToken token = default) => _func(token);
}
// Will execute Dispatchee2 second.
[DispatchOrder(2)]
public class Dispatchee2 : Dispatchee
{
private readonly Func<CancellationToken, Task> _func;
public MockDispatchee2(Func<CancellationToken, Task> func, DispatchTime dispatchTime) : base(dispatchTime)
{
_func = func;
}
public override Task ExecuteAsync(CancellationToken token = default) => _func(token);
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.1
- No dependencies.
-
net5.0
- No dependencies.
-
net6.0
- No dependencies.
-
net7.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.