ITMinds.HangfireMediator 0.2.0

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

// Install ITMinds.HangfireMediator as a Cake Tool
#tool nuget:?package=ITMinds.HangfireMediator&version=0.2.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

Hangfire Service Registration

Be sure to add the UseMediatR configuration extension for the Hangfire registration.

services.AddHangfire(configuration =>
{
  configuration.SetDataCompatibilityLevel(CompatibilityLevel.Version_170);

  // ...
  configuration.UseMediatR();
});

Enqueueing jobs

Following the setup you can enqueue as part of the mediator pattern to run jobs in the background as part of the Hangfire queue system. All you have to do is instead of .Send you write .Enqueue.

mediator.Enqueue(new ExampleQuery { });

Optional: Setup recurring jobs

You can easily register recurring jobs like this:

using HangfireMediator;

public static IMediator SetupHangfireJobs(this IMediator mediator)
{
  mediator.RecurringJob(
    new ExampleQuery { },
    "Hourly Example Query",
    Cron.Hourly()
  );

  return mediator;
}
Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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,908 4/28/2022
1.0.0 1,323 11/18/2021
1.0.0-alpha.2 178 11/8/2021
1.0.0-alpha.1 198 11/8/2021
0.2.0 750 11/8/2021
0.1.0 779 11/8/2021