MongoDB support for Hangfire library. By using this library you can store all jobs information in MongoDB.
To install Hangfire MongoDB Storage, run the following command in the Nuget Package Manager Console:
PM> Install-Package HangFire.Mongo
public void Configuration(IAppBuilder app)
{
GlobalConfiguration.Configuration.UseMongoStorage("<connection string>", "<database name>");
app.UseHangfireServer();
app.UseHangfireDashboard();
}
For example:
public void Configuration(IAppBuilder app)
{
GlobalConfiguration.Configuration.UseMongoStorage("mongodb://localhost", "ApplicationDatabase");
app.UseHangfireServer();
app.UseHangfireDashboard();
}
To use custom prefix for collections names specify it on Hangfire setup:
public void Configuration(IAppBuilder app)
{
GlobalConfiguration.Configuration.UseMongoStorage("<connection string>", "<database name>",
new MongoStorageOptions { Prefix = "custom" } );
app.UseHangfireServer();
app.UseHangfireDashboard();
}
Hangfire.Mongo is released under the MIT License.