ITMinds.HangfireMediator
1.1.0
dotnet add package ITMinds.HangfireMediator --version 1.1.0
NuGet\Install-Package ITMinds.HangfireMediator -Version 1.1.0
<PackageReference Include="ITMinds.HangfireMediator" Version="1.1.0" />
paket add ITMinds.HangfireMediator --version 1.1.0
#r "nuget: ITMinds.HangfireMediator, 1.1.0"
// Install ITMinds.HangfireMediator as a Cake Addin
#addin nuget:?package=ITMinds.HangfireMediator&version=1.1.0
// Install ITMinds.HangfireMediator as a Cake Tool
#tool nuget:?package=ITMinds.HangfireMediator&version=1.1.0
IT Minds Hangfire Mediator Bridge
This library creates a simple bridge between MediatR and Hangfire, enabling hangfire to be used under the hood as a schedule/background job runner of the mediator pattern.
Usage
The methods you will be using are entity extensions upon the IMediator
interface.
Setup: Hangfire Service Registration
Be sure to add the UseMediatR
configuration extension for the Hangfire registration.
services.AddHangfire(configuration =>
{
// ...
configuration.UseMediatR();
});
Enqueueing jobs
Following the setup, you can enqueue your jobs as part of the mediator pattern to run in the background. All you have to do is instead of .Send
you write .Enqueue
. Note: current implementation is limited to Enqueue being a void method.
mediator.Enqueue(new ExampleQuery { });
Optional: Setup recurring jobs
You can easily register recurring jobs with the .Enqueue
method.
Here is an example of a mass registration:
using HangfireMediator;
public static IMediator SetupHangfireJobs(this IMediator mediator)
{
mediator.RecurringJob(
new ExampleQuery { },
"Hourly Example Query",
Cron.Hourly()
);
//...
return mediator;
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | 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 was computed. 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. |
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated | |
---|---|---|---|
1.1.0 | 8,481 | 4/28/2022 | |
1.0.0 | 1,315 | 11/18/2021 | |
1.0.0-alpha.2 | 176 | 11/8/2021 | |
1.0.0-alpha.1 | 197 | 11/8/2021 | |
0.2.0 | 748 | 11/8/2021 | |
0.1.0 | 776 | 11/8/2021 |