Quartz.Plugins (opens new window) provides some useful ready-mady plugins for your convenience.
You need to add NuGet package reference to your project which uses Quartz.
Plugins are configured by using either DI configuration extensions or adding required configuration keys.
Configuration key in in format
See configuration reference on how to configure each plugin
Logs a history of all job executions (and execution vetoes) and writes the entries to configured logging infrastructure.
This plugin catches the event of the VM terminating (such as upon a CRTL-C) and tells the scheduler to Shutdown.
This plugin loads XML file(s) to add jobs and schedule them with triggers as the scheduler is initialized, and can optionally periodically scan thefile for changes.
The periodically scanning of files for changes is not currently supported in a clustered environment.
This plugin catches the event of job running for a long time (more than the configured max time) and tells the scheduler to "try" interrupting it if enabled.
Quartz 3.3 or later required.
Each job configuration needs to have
JobInterruptMonitorPlugin.JobDataMapKeyAutoInterruptable key's value set to true in order for plugin to monitor the execution timeout.
Jobs can also define custom timeout value instead of global default by using key
var job = JobBuilder.Create<SlowJob>() .WithIdentity("slowJob") .UsingJobData(JobInterruptMonitorPlugin.JobDataMapKeyAutoInterruptable, true) // allow only five seconds for this job, overriding default configuration .UsingJobData(JobInterruptMonitorPlugin.JobDataMapKeyMaxRunTime, TimeSpan.FromSeconds(5).TotalMilliseconds.ToString())); .Build();