Quartz.NET ASP.NET Core integration; Quartz Scheduling Framework for .NET
$ dotnet add package Quartz.AspNetCoreQuartz.AspNetCore provides integration with ASP.NET Core hosted services.
::: tip If you only need the generic host, generic host integration might suffice. :::
You need to add NuGet package reference to your project which uses Quartz.
Install-Package Quartz.AspNetCore
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;
});
}