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

    • Quartz 3 Quick Start
    • Tutorial
      • Using Quartz
      • Library Overview
      • Jobs And Triggers
      • More About Jobs
      • More About Triggers
      • 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
    • Frequently Asked Questions
    • Best Practices
    • Troubleshooting
    • API Documentation
    • Database Schema
    • 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
  • Unreleased Releases

    • Quartz 4.x
      • Quartz 4 Quick Start
      • Tutorial
        • Using Quartz
        • Jobs And Triggers
        • More About Jobs & JobDetails
        • More About Triggers
        • Simple Triggers
        • Cron Triggers
        • RecurrenceTrigger
        • Trigger and Job Listeners
        • Scheduler Listeners
        • Job Stores
        • Configuration, Resource Usage and SchedulerFactory
        • Advanced (Enterprise) Features
        • Miscellaneous Features
        • CronTrigger Tutorial
      • Configuration Reference
      • Migration Guide
      • Troubleshooting
      • API Documentation
      • How To's

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

        • Quartz Core Additions

          • Dashboard
          • Jobs
          • JSON Serialization
          • Plugins
        • Integrations

          • ASP.NET Core Integration
          • HTTP API
          • 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

Rescheduling Jobs

A few ways to approach a need to reschedule a job.

Manually Retry

When a Quartz job is running, and an unhandled exception escapes the IJob, the Quartz system will mark the job in an error state. This would then allow you to reschedule the job using any method that would be work for your system.

Using JobExecutionException

One simple option is to use the JobExecutionException to control if the job should refire immediately or not.

public async Task Execute(IJobExecutionContext context)
{
    try 
    {
        // do work
    } catch (Exception ex)
    {
        throw new JobExecutionException(ex, refireImmediately: true)
        {
            UnscheduleFiringTrigger = true,
            UnscheduleAllTriggers = true
        };
    }
}

Polly Retries

If your job simply needs to retry its work, then you could wrap the job in a Polly policy, and use the policy definitions to retry it. Note that using Polly to implement long running retries will maintain a job slot, and prevent the job engine for performing more work.

Self-Rescheduling

If your job needs more time, say it needs to wait 5 minutes, the IJobExecutionContext has access to the scheduler on it. You could use that to reschedule the job, and let it exit normally.

public async Task Execute(IJobExecutionContext context)
{
    // something happens, that tells you to delay the processing
    // like getting an HTTP 429 - Too Many requests
    var oldTrigger = context.Trigger;
    var newTrigger = TriggerBuilder.Create()
        .ForJob(context.JobDetail)
        .WithIdentity($"{oldTrigger.Key.Name}-retry", oldTrigger.Key.Group)
        .StartAt(DateTimeOffset.UtcNow.AddMinutes(5))
        .Build();
    await context.Scheduler.ScheduleJob(newTrigger);
}

Self-Descheduling

Another approach, is to have the job run every 5 minutes (or some other suitable cadence) and after succeeding cancel itself. This has the added benefit of being easier to logically reason about, but could still be making calls to the downstream services.

public async Task Execute(IJobExecutionContext context)
{
    // work succeeds
    if(success)
    {
        await context.Scheduler.UnscheduleJob(context.Trigger.Key);
    }
}

GitHub Discussion

Help us by improving this page!
Last Updated: 4/4/26, 1:40 PM
Contributors: Marko Lahma, Claude Opus 4.6 (1M context)
Prev
Using the CronTrigger