Quartz.NETQuartz.NET
Home
Features
Blog
Discussions
NuGet
GitHub
Home
Features
Blog
Discussions
NuGet
GitHub
  • Getting Started

    • Overview
    • Quartz 4 Quick Start
    • Tutorial
      • Using Quartz
      • Jobs And Triggers
      • More About Jobs & JobDetails
      • Job Data
      • More About Triggers
      • Querying Jobs and Triggers
      • Simple Triggers
      • Cron Triggers
      • RecurrenceTrigger
      • Time and TimeProvider
      • Trigger and Job Listeners
      • Scheduler Listeners
      • Job Execution Middleware
      • Job Stores
      • Configuration, Resource Usage and Building a Scheduler
      • Building a Scheduler Without a Host
      • Clustering
      • Execution Groups
      • Node Affinity (Preferred Node)
      • Testing
    • Configuration Reference
    • JSON Configuration
    • Cron Expression Reference
    • Multi-Tenancy
    • Frequently Asked Questions
    • Best Practices
    • Before You Go Live
    • Operating a Cluster
    • Log Events
    • Tenancy Patterns
    • Database Schema
    • Database Schema Changes
    • Migration Guide
    • Troubleshooting
    • API Documentation
  • How To's
    • One-Off Job
    • Rescheduling Jobs
    • Retrying Failed Jobs
    • Multiple Triggers
    • Job Template
    • Running Quartz under Aspire
    • Quartz.NET with Wolverine
    • Embedding Quartz in a Library
    • Running under an External Leader Election
    • Publishing Trimmed and Native AOT
    • Extending Quartz: what is open, what is closed, and how to ask
    • A Job Store of Your Own
    • A Driver Delegate for a New Database
    • Persisting a Custom Trigger Type
    • A Lock Handler of Your Own
  • Packages

    • Quartz Core Additions

      • Jobs
      • Serialization (System.Text.Json)
      • JSON Serialization
      • Plugins
    • Integrations

      • Aspire Integration
      • ASP.NET Core Integration
      • HTTP API
      • HTTP Client
      • Dashboard
      • Hosted Services Integration
      • Microsoft DI Integration
      • Multiple Schedulers with Microsoft DI
      • Observability
      • Redis Lock Handler
      • TimeZoneConverter Integration
    • 3rd Party Plugins for Quartz
  • Quartz 3.x

    • Getting Started

      • Quartz 3 Quick Start
      • Tutorial
        • Using Quartz
        • Library Overview
        • Jobs And Triggers
        • More About Jobs
        • More About Triggers
        • Execution Groups
        • Node Affinity (Preferred Node)
        • Simple Triggers
        • Cron Triggers
        • RecurrenceTrigger
        • Trigger and Job Listeners
        • Scheduler Listeners
        • Job Stores
        • Tuning the Scheduler
        • Configuration, Resource Usage and SchedulerFactory
        • Advanced (Enterprise) Features
      • Configuration Reference
      • JSON Configuration
      • Multi-Tenancy
      • Frequently Asked Questions
      • Best Practices
      • Tenancy Patterns
      • Troubleshooting
      • API Documentation
      • Database Schema
      • Database Schema Changes
      • Migration Guide
      • Miscellaneous Features
    • How To's

      • One-Off Job
      • Multiple Triggers
      • Job Template
      • Using the CronTrigger
      • Rescheduling Jobs
    • Packages

      • Quartz Core Additions

        • Dashboard
        • Jobs
        • Serialization (System.Text.Json)
        • Serialization (Newtonsoft Json.NET)
        • Plugins
      • Integrations

        • ASP.NET Core Integration
        • Hosted Services Integration
        • Microsoft DI Integration
        • Multiple Schedulers with Microsoft DI
        • OpenTelemetry Integration
        • OpenTracing Integration
        • Redis Lock Handler
        • TimeZoneConverter Integration
      • 3rd Party Plugins for Quartz
  • Old Releases

    • Quartz 2.x
      • Quartz 2 Quick Start
      • Tutorial
        • Lesson 1: Using Quartz
        • Lesson 2: Jobs And Triggers
        • Lesson 3: More About Jobs & JobDetails
        • Lesson 4: More About Triggers
        • Lesson 5: SimpleTrigger
        • Lesson 6: CronTrigger
        • Lesson 7: TriggerListeners and JobListeners
        • Lesson 8: SchedulerListeners
        • Lesson 9: JobStores
        • Lesson 10: Configuration, Resource Usage and SchedulerFactory
        • Lesson 11: Advanced (Enterprise) Features
        • Lesson 12: Miscellaneous Features of Quartz
        • CronTrigger Tutorial
      • Configuration Reference
      • Migration Guide
      • API Documentation
    • Quartz 1.x
      • Tutorial
        • Lesson 1: Using Quartz
        • Lesson 2: Jobs And Triggers
        • Lesson 3: More About Jobs & JobDetails
        • Lesson 4: More About Triggers
        • Lesson 5: SimpleTrigger
        • Lesson 6: CronTrigger
        • Lesson 7: TriggerListeners and JobListeners
        • Lesson 8: SchedulerListeners
        • Lesson 9: JobStores
        • Lesson 10: Configuration, Resource Usage and SchedulerFactory
        • Lesson 11: Advanced (Enterprise) Features
        • Lesson 12: Miscellaneous Features of Quartz
      • API Documentation
  • License

Quartz.NET 3.x

These are the documents for the 3.x line, which is maintained. Quartz.NET 4.x is the current release; the migration guide says what changed and what to do about it.

Quartz.Plugins provides some useful ready-made plugins for your convenience.

Installation

You need to add NuGet package reference to your project which uses Quartz.

Install-Package Quartz.Plugins

Configuration

Plugins are configured by using either DI configuration extensions or adding required configuration keys.

Configuration key in in format quartz.plugin.{name-to-refer-with}.{property}.

See configuration reference on how to configure each plugin

Features

LoggingJobHistoryPlugin

Logs a history of all job executions (and execution vetoes) and writes the entries to configured logging infrastructure.

StructuredLoggingJobHistoryPlugin

Structured logging alternative to LoggingJobHistoryPlugin. Uses named message template parameters (e.g. {JobName}, {TriggerGroup}) instead of index-based placeholders, making log output compatible with structured logging sinks like Serilog and NLog. This avoids template cache memory leaks that can occur with the original plugin.

Message templates can be customized via properties. When customizing, the parameter names in templates are positionally mapped, so they must appear in the same order as the defaults.

Available template properties:

PropertyParameters (in order)
JobToBeFiredMessage{JobGroup}, {JobName}, {TriggerGroup}, {TriggerName}, {FireTime}, {ScheduledFireTime}, {NextFireTime}, {RefireCount}
JobSuccessMessage{JobGroup}, {JobName}, {FireTime}, {TriggerGroup}, {TriggerName}, {Result}
JobFailedMessage{JobGroup}, {JobName}, {FireTime}, {TriggerGroup}, {TriggerName}, {ExceptionMessage}
JobWasVetoedMessage{JobGroup}, {JobName}, {TriggerGroup}, {TriggerName}, {FireTime}

DI configuration:

services.AddQuartz(q =>
{
    q.UseStructuredJobLogging();
});

Tips

Recommended over LoggingJobHistoryPlugin when using structured logging providers (Serilog, NLog, etc.).

StructuredLoggingTriggerHistoryPlugin

Structured logging alternative to LoggingTriggerHistoryPlugin. Logs trigger firings, misfires, and completions using named message template parameters for structured logging compatibility.

Message templates can be customized via properties. When customizing, the parameter names in templates are positionally mapped, so they must appear in the same order as the defaults.

Available template properties:

PropertyParameters (in order)
TriggerFiredMessage{TriggerGroup}, {TriggerName}, {JobGroup}, {JobName}, {FireTime}, {ScheduledFireTime}, {NextFireTime}, {RefireCount}
TriggerMisfiredMessage{TriggerGroup}, {TriggerName}, {JobGroup}, {JobName}, {FireTime}, {ScheduledFireTime}, {NextFireTime}
TriggerCompleteMessage{TriggerGroup}, {TriggerName}, {JobGroup}, {JobName}, {CompletedTime}, {ScheduledFireTime}, {NextFireTime}, {TriggerInstructionCode}

DI configuration:

services.AddQuartz(q =>
{
    q.UseStructuredTriggerLogging();
});

Tips

Recommended over LoggingTriggerHistoryPlugin when using structured logging providers (Serilog, NLog, etc.).

ShutdownHookPlugin

This plugin catches the event of the VM terminating (such as upon a CRTL-C) and tells the scheduler to Shutdown.

XMLSchedulingDataProcessorPlugin

This plugin loads XML file(s) to add jobs and schedule them with triggers as the scheduler is initialized, and can optionally periodically scan the file for changes.

Warning

The periodically scanning of files for changes is not currently supported in a clustered environment.

JobInterruptMonitorPlugin

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.

Tips

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 JobInterruptMonitorPlugin.JobDataMapKeyMaxRunTime.

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(CultureInfo.InvariantCulture))
    .Build();

Both AutoInterruptable and MaxRunTime are read from the merged job data map, so a trigger's data map can also enable interruption or override the timeout for its own fires.

Only the execution that exceeded its allowed run time is interrupted — the plugin monitors each fire instance separately, so concurrent executions of the same job are unaffected. Executions vetoed by a trigger listener do not arm the interrupt timer.

Authoring plugin configuration extensions

Tips

Quartz 3.19 or later required.

When you write your own ISchedulerPlugin, you can offer the same strongly typed configuration experience as the built-in plugins by creating an extension method that targets IPropertyConfigurationRoot. The UsePlugin helper takes care of the whole registration: it sets the quartz.plugin.{name}.type property and, when the configuration is backed by Microsoft DI (AddQuartz), registers the plugin type into the container so it gets constructed with constructor injection.

public static class MyPluginConfigurationExtensions
{
    public static T UseMyPlugin<T>(this T configurer, Action<MyPluginOptions>? configure = null)
        where T : IPropertyConfigurationRoot
    {
        configurer.UsePlugin<MyPlugin>("myPlugin");

        // optional: register companion services your plugin needs injected;
        // returns false when there is no container (plain SchedulerBuilder usage)
        configurer.TryRegisterSingleton<IMyPluginDependency, MyPluginDependency>();

        configure?.Invoke(new MyPluginOptions(configurer));
        return configurer;
    }
}

Strongly typed options use the PropertiesSetter base class with the plugin's property prefix; each property setter maps to a quartz.plugin.{name}.{property} configuration key that gets applied to the plugin's public setters:

public sealed class MyPluginOptions : PropertiesSetter
{
    internal MyPluginOptions(IPropertySetter parent) : base(parent, "quartz.plugin.myPlugin")
    {
    }

    // maps to quartz.plugin.myPlugin.someSetting and MyPlugin.SomeSetting setter
    public string SomeSetting
    {
        set => SetProperty("someSetting", value);
    }
}

The same extension method then works with all configuration styles:

// Microsoft DI - plugin is constructed by the container, constructor injection available
services.AddQuartz(q =>
{
    q.UseMyPlugin(options =>
    {
        options.SomeSetting = "value";
    });
});

// plain SchedulerBuilder - plugin is created via reflection and needs
// a public parameterless constructor
var scheduler = await SchedulerBuilder.Create()
    .UseMyPlugin()
    .BuildScheduler();
Help us by improving this page!
Last Updated: 9/10/26, 8:50 AM
Contributors: Marko Lahma, Claude Opus 5 (1M context)
Prev
Serialization (Newtonsoft Json.NET)