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
      • 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
    • 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
      • OpenTelemetry Integration
      • OpenTracing Integration
      • 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
        • Trigger and Job Listeners
        • Scheduler Listeners
        • Job Stores
        • Configuration, Resource Usage and SchedulerFactory
        • Advanced (Enterprise) Features
        • Miscellaneous Features
        • CronTrigger Tutorial
      • Configuration Reference
      • Migration Guide
      • 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
          • OpenTelemetry Integration
          • OpenTracing Integration
          • 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 is designed with the ability to register a job with multiple triggers. Each job can have a base line set of data, and then each trigger can bring its own set of data as well. During the job execution Quartz will merge the data for you, with the data in the trigger overriding the data in the job.

Our example job:

public class HelloJob : IJob
{
    public static readonly JobKey Key = new JobKey("customer-process", "group");

    public async Task Execute(IJobExecutionContext context)
    {
        var customerId = context.MergedJobDataMap.GetString("CustomerId");
        var batchSize = context.MergedJobDataMap.GetString("batch-size");

        await Console.WriteLineAsync($"CustomerId={customerId} batch-size={batchSize}")
    }
}

Below, we have two triggers, each with their own set of data, but we only had to register the one job.

public Task DoSomething(IScheduler schedule, CancellationToken ct)
{
    var job = JobBuilder.Create<HelloJob>()
                        .WithIdentity(HelloJob.Key)
                        .Build();
    
    await schedule.AddJob(job, replace: true, storeNonDurableWhileAwaitingScheduling: true, ct);

    // Trigger 1
    var jobData1 = new JobDataMap { { "CustomerId", "1" } };
    await scheduler.TriggerJob(new JobKey("customer-process", "group"), jobData1, ct);

    // Trigger 2
    var jobData2 = new JobDataMap { { "CustomerId", "2" } };
    await scheduler.TriggerJob(new JobKey("customer-process", "group"), jobData2, ct);
}

When this runs you will see:

CustomerId=1 batch-size=
CustomerId=2 batch-size=

Job Data and Trigger Data

You could even set common data parameters on the job itself. Here we are adding some job data to the job itself.

public Task DoSomething(IScheduler schedule, CancellationToken ct)
{
    var job = JobBuilder.Create<AnExampleJob>()
                        .WithIdentity(HelloJob.Key)
                        .UsingJobData("batch-size", "50")
                        .Build();
    
    await schedule.AddJob(job, replace: true, storeNonDurableWhileAwaitingScheduling: true, ct);

    // Trigger 1
    var jobData1 = new JobDataMap { { "CustomerId", 1 } };
    await scheduler.TriggerJob(HelloJob.Key, jobData1, ct);

    // Trigger 2
    var jobData2 = new JobDataMap { { "CustomerId", 2 } };
    await scheduler.TriggerJob(HelloJob.Key, jobData2, ct);
}

When this runs you will see:

CustomerId=1 batch-size=50
CustomerId=2 batch-size=50
Help us by improving this page!
Last Updated: 3/6/26, 11:09 AM
Contributors: Copilot, lahma
Prev
One-Off Job
Next
Job Template