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.

Jobs and Triggers

Jobs and Triggers are the core of the Quartz library.

Jobs

A job is a class that implements the IJob interface, which has one method:

namespace Quartz
{
    public interface IJob
    {
        Task Execute(JobExecutionContext context);
    }
}

When the job's trigger fires, one of the scheduler's worker threads calls Execute(..). The JobExecutionContext passed to it describes the job's run-time environment: the IScheduler that executed it, the Trigger that fired it, the job's IJobDetail object, and a few other items.

Your program creates the IJobDetail when it adds the job to the scheduler. It is the definition of the job instance: property settings for the job, and a JobDataMap that can store state for a given instance of your job class. The next lesson covers it in detail.

Triggers

A trigger fires the execution of a job. To schedule a job, create a trigger and set its properties to the schedule you want. A trigger can have its own JobDataMap, to pass the job parameters specific to that trigger's firings. Quartz has several trigger types; the most used are the simple trigger (interface ISimpleTrigger) and the cron trigger (interface ICronTrigger).

Warning

cron is an early Linux command-line job scheduler with its own schedule format. CronTrigger uses a different format, with seconds as the first field. More...

SimpleTrigger is for 'one-shot' execution (a single execution at a given moment), or for firing at a given time and repeating N times with a delay of T between executions, much like the .NET Timer class.

var example = TriggerBuilder.Create()
    .WithIdentity("trigger-name", "trigger-group")
    .ForJob("job-name", "job-group")
    .WithSimpleSchedule(o =>
    {
        o.WithRepeatCount(5)
            .WithInterval(TimeSpan.FromMinutes(5));
    })
    .Build();

CronTrigger is for calendar-like schedules, such as "every Friday, at noon" or "at 10:15 on the 10th day of every month". WithCronSchedule supports H (hash) tokens to spread fire times across triggers. See CronTrigger for the syntax, and CronExpressionBuilder to compose an expression without writing the string.

var example = TriggerBuilder.Create()
    .WithIdentity("trigger-name", "trigger-group")
    .ForJob("job-name", "job-group")
    .WithCronSchedule("45 23 * * 6")
    .Build();

RecurrenceTrigger (Quartz 3.18+) is for calendar patterns cron cannot express, such as "every 2nd Monday of the month", "every other week on specific days" or "the last weekday of March each year". It uses RFC 5545 RRULE strings.

var example = TriggerBuilder.Create()
    .WithIdentity("trigger-name", "trigger-group")
    .ForJob("job-name", "job-group")
    .WithRecurrenceSchedule("FREQ=MONTHLY;BYDAY=2MO")
    .Build();

Why Jobs and Triggers?

Quartz separates the schedule (trigger) from the work (job). As a result:

  • Jobs can be stored in the scheduler without a trigger, and many triggers can use the same job.
  • A job can stay in the scheduler after its triggers have expired, and be rescheduled later without being re-defined.
  • A trigger can be modified or replaced without re-defining its job.

Identities

Jobs and triggers get identifying keys (JobKey and TriggerKey) when they are registered with the scheduler. A key has a name and a group; groups organize jobs and triggers into categories such as "reporting jobs" and "maintenance jobs". The name must be unique within the group, and name plus group is the complete key.

More in Lesson 4: More About Jobs & JobDetails and Lesson 5: More About Triggers.

Help us by improving this page!
Last Updated: 10/16/26, 2:35 AM
Contributors: Marko Lahma, Claude Opus 5.5
Prev
Library Overview
Next
More About Jobs