Quartz.AspNetCore (opens new window) provides integration with ASP.NET Core hosted services (opens new window).
TIP
If you only need the generic host, generic host integration might suffice.
# Installation
You need to add NuGet package reference to your project which uses Quartz.
Install-Package Quartz.AspNetCore
# Using
You can add Quartz configuration by invoking an extension method AddQuartzServer
on IServiceCollection
.
This will add a hosted quartz server into ASP.NET Core process that will be started and stopped based on applications lifetime.
TIP
See Quartz.Extensions.DependencyInjection documentation to learn more about configuring Quartz scheduler, jobs and triggers.
Example Startup.ConfigureServices configuration
public void ConfigureServices(IServiceCollection services)
{
services.AddQuartz(q =>
{
// base quartz scheduler, job and trigger configuration
});
// ASP.NET Core hosting
services.AddQuartzServer(options =>
{
// when shutting down we want jobs to complete gracefully
options.WaitForJobsToComplete = true;
});
}