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
      • Compile-Time Checks
      • Declaring Jobs with Attributes
      • Delegate Jobs
    • Configuration Reference
    • JSON Configuration
    • Cron Expression Reference
    • Multi-Tenancy
    • Comparison
    • 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
    • Backfill
    • Retrying Failed Jobs
    • Pausing with a Reason
    • Job Continuations
    • Overlap Policy
    • Progress and Execution Logs
    • Job Outcomes
    • Multiple Triggers
    • Job Template
    • Running Quartz under Aspire
    • Quartz.NET with Wolverine
    • Coming from Hangfire
    • Coming from TickerQ
    • 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
      • Dashboard Agent
      • Hosted Services Integration
      • Microsoft DI Integration
      • Multiple Schedulers with Microsoft DI
      • Observability
      • Redis Lock Handler
      • TimeZoneConverter Integration
      • Weasel Schema Management
    • 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 ready-made plugins.

Installation

Install-Package Quartz.Plugins

Configuration

Configure plugins with the DI configuration extensions or with configuration keys of the form quartz.plugin.{name-to-refer-with}.{property}. The configuration reference shows how to configure each plugin.

Features

LoggingJobHistoryPlugin

Logs every job execution (and execution veto) to the configured logging infrastructure.

StructuredLoggingJobHistoryPlugin

Structured logging alternative to LoggingJobHistoryPlugin. It uses named message template parameters (e.g. {JobName}, {TriggerGroup}) instead of index-based placeholders, for structured logging sinks such as Serilog and NLog. It also avoids the template cache memory leaks the original plugin can cause.

Message templates can be customized through properties. Parameters are mapped by position, so a custom template must keep them in the default order:

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 with named message template parameters.

Message templates can be customized through properties. Parameters are mapped by position, so a custom template must keep them in the default order:

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

Shuts the scheduler down when the VM terminates (such as on CTRL-C).

XMLSchedulingDataProcessorPlugin

Loads XML file(s) and schedules their jobs and triggers when the scheduler initializes. It can also scan the files for changes periodically.

Warning

Periodic scanning for changes is not supported in a clustered environment.

JobInterruptMonitorPlugin

If enabled, asks the scheduler to try interrupting a job that runs longer than the configured maximum time.

Tips

Quartz 3.3 or later required.

The plugin monitors only jobs whose JobInterruptMonitorPlugin.JobDataMapKeyAutoInterruptable value is true. A job can override the global default timeout with 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();
  • AutoInterruptable and MaxRunTime are read from the merged job data map, so a trigger's data map can enable interruption or override the timeout for its own fires.
  • Only the execution that exceeded its run time is interrupted. Each fire instance is monitored separately, so concurrent executions of the same job are unaffected.
  • Executions vetoed by a trigger listener do not start the interrupt timer.

Authoring plugin configuration extensions

Tips

Quartz 3.19 or later required.

To give your own ISchedulerPlugin strongly typed configuration like the built-in plugins, write an extension method on IPropertyConfigurationRoot. The UsePlugin helper does the registration: it sets the quartz.plugin.{name}.type property and, when Microsoft DI (AddQuartz) backs the configuration, registers the plugin type in the container so it is 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 derive from PropertiesSetter with the plugin's property prefix. Each property setter maps to a quartz.plugin.{name}.{property} key, which is applied to the plugin's public setter:

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 extension method works with every configuration style:

// 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: 10/19/26, 11:26 PM
Contributors: Marko Lahma, Claude Opus 5.5
Prev
Serialization (Newtonsoft Json.NET)