NomSol Hangfire Job Manager is a robust extension for managing Hangfire jobs dynamically, designed to streamline job creation, updates, and monitoring via a database.
- Install the package: This library can be added to your project as a NuGet package.
dotnet add package NomSol.Hangfire.JobManager.SqlServer // add the following to generate a sample job
var nomsolJobManagerOptions = new NomSolJobManagerOptions
{
GenerateSampleJob = true
};
services.AddHangfireJobManagerBusinessServices();
services.AddHangfire(config =>
{
config.UseSqlServerStorage(conStrings.HangfireDatabase, storageOptions);
config.UseConsole();
config.UseJobManagerWithSql(serviceProvider: services.BuildServiceProvider(), services, sqlOptions: storageOptions, nomSolJobManagerOptions: nomsolJobManagerOptions);
config.SetDataCompatibilityLevel(CompatibilityLevel.Version_180);
config.UseDefaultCulture(CultureInfo.GetCultureInfo("en-US"));
});A couple new tables will be added to your database to manage jobs. The tables are:
- JobManager
- This table contains the job details and is used to manage recurring jobs.
- FireForgetJobManager
- This table contains the job details and is used to manage fire and forget jobs.
Please refer to the sample project for a demonstration of how to use this library.