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

Configuration, Resource Usage and Building a Scheduler

Quartz is designed in a modular way: a scheduler is assembled from a thread pool, a job store, whatever data sources that store needs, and the settings of the scheduler itself. The service container puts those pieces together, and AddQuartz is where you say which ones you want.

The major components that can be configured are:

  • The thread pool. DefaultThreadPool runs jobs as tasks on the CLR's managed thread pool; its one setting, MaxConcurrency, limits how many jobs a node runs at once. q.UseDefaultThreadPool(20), or q.UseThreadPool<T>() for one of your own.
  • The job store, discussed in Lesson 10: q.UseInMemoryStore() or q.UsePersistentStore(…).
  • Data sources, when the store is a persistent one — part of the same UsePersistentStore call.
  • The scheduler itself: q.ConfigureScheduler(options => …) for its name, id, idle wait time and batching.

Every option of every one of those, in both its typed and its flat spelling, is tabulated in the configuration reference.

Building a scheduler without a container

An application with no host — a console application, or a test — builds a scheduler with QuartzSchedulerBuilder. Its Create callback is the AddQuartz callback, over a container it creates itself, so what works in one works in the other:

IScheduler scheduler = await QuartzSchedulerBuilder
    .Create(q => q
        .ConfigureScheduler(options => options.InstanceName = "reporting")
        .UseDefaultThreadPool(maxConcurrency: 10)
        .UseInMemoryStore())
    .BuildScheduler();

Every configuration method returns the builder itself, so the whole thing is one expression. Nothing starts on its own: without a hosted service, starting the scheduler is your call, and so is shutting it down.

Building a Scheduler Without a Host is the full lesson — Build() versus BuildScheduler(), what owning the container means for disposal, persistent and clustered standalone schedulers, and what the container-first path adds that this one lacks.

Configuring from properties

A scheduler can also be configured from a set of flat quartz.* properties (NameValueCollection) instead of in code. The properties are generally stored in and loaded from a file, but can also be created by your program and handed to the builder:

await using StandaloneSchedulerFactory schedulerFactory = QuartzSchedulerBuilder.Create()
    .UseProperties(properties)
    .Build();

The keys are translated into the same options and registrations the code-based API produces, so a scheduler configured this way is the same scheduler, and the two can be mixed — what is written in code wins. Keys are checked against the ones Quartz reads, so a misspelling is reported rather than silently leaving a setting at its default.

Every key, and the option it maps to, is listed under Legacy property keys.

Logging

Quartz logs through Microsoft.Extensions.Logging. Under a host, or anywhere else the scheduler is built from a container, it uses whatever logging the application has configured and there is nothing to set up. Quartz does not log much: some information while starting, and then only serious problems while jobs run.

That covers the scheduler and everything it is built from: the scheduling loop, the job store and the cluster manager and misfire handler it owns, the thread pool, the job factory. What it does not cover is what no container builds — a listener or a trigger you constructed yourself, the static helpers, the jobs in Quartz.Jobs — and a scheduler built by QuartzSchedulerBuilder, whose container has no logging providers of its own unless you register some on its Services. Those say where logging goes with one call:

// obtain your logger factory, for example from IServiceProvider
ILoggerFactory loggerFactory = serviceProvider.GetRequiredService<ILoggerFactory>();

LogProvider.SetLogProvider(loggerFactory);

LogProvider is in Quartz.Diagnostics, and also hands out loggers — LogProvider.CreateLogger<T>() — for the same situation.

Help us by improving this page!
Last Updated: 9/10/26, 8:50 AM
Contributors: Marko Lahma, Claude Opus 5 (1M context)
Prev
Job Stores
Next
Building a Scheduler Without a Host