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
      • Aspire Hosting
      • ASP.NET Core Integration
      • HTTP API
      • HTTP Client
      • Dashboard
      • Dashboard Agent
      • Dashboard Host
      • 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

Aspire Hosting

Quartz.Aspire.Hosting is the Quartz.NET hosting integration for Aspire (4.8): an AppHost resource that runs the dashboard host's image beside your workers. It shows every scheduler in a database, and the schedulers of the workers that dial in as agents.

dotnet add package Quartz.Aspire.Hosting

In the AppHost project. The workers keep Quartz.Aspire, the client integration, for their store.

Usage

var builder = DistributedApplication.CreateBuilder(args);

var quartzDb = builder.AddPostgres("postgres").AddDatabase("quartz");

var dashboard = builder.AddQuartzDashboard("quartz-dashboard")
    .WithAttachedStore(quartzDb);

builder.AddProject<Projects.Orders_Worker>("orders")
    .WithReference(quartzDb)
    .WithReference(dashboard);

builder.Build().Run();

The worker dials in with UseDashboardAgent(), which reads what WithReference(dashboard) sets:

HostApplicationBuilder builder = Host.CreateApplicationBuilder(args);

builder.AddQuartz(q =>
{
    // Endpoint, Token and Target come from Quartz:DashboardAgent - an Aspire AppHost's
    // WithReference(dashboard) sets them as Quartz__DashboardAgent__* environment variables.
    q.UseDashboardAgent();
});

builder.AddQuartzHostedService();

Open the resource's URL in the Aspire dashboard: it signs the browser in as an administrator.

  • Choose one per scheduler. WithAttachedStore shows every scheduler in the database, read from its tables; WithReference(dashboard) shows the worker's scheduler through the worker. A scheduler reached both ways is listed twice.
  • An agent is driven through its worker: starting, standing by, interrupting and the live events work. A store-attached scheduler is read from the database; see What a window can and cannot do.

The calls

CallWhat it does
AddQuartzDashboard(name, port, adminToken, agentToken)Adds the dashboard container. port is the host port; the tokens default to generated secrets
WithAttachedStore(database, target, configure)Shows every scheduler in database, under target (default: the database resource's name). Waits for the database
WithReference(dashboard, schedulerName)Makes this resource's scheduler an agent of dashboard, under the target {resource} or {resource}-{schedulerName}
WithImageTag(tag)Runs another version of the image (Aspire's own call)

QuartzAttachedStoreSettings, the configure callback's argument, says what the nodes writing the database were configured with: Provider (inferred when unset), TablePrefix, Serializer, ExecutionHistory and RediscoveryInterval. Each is the store-attached target key of the same name.

  • A target name is one scheduler's. A second store or agent under a name the dashboard already has throws while the AppHost is built.
  • schedulerName is for a worker with several named schedulers: it writes that scheduler's own section, Quartz__Schedulers__{schedulerName}__DashboardAgent__*.

Tokens and the sign-in link

ParameterGenerated asWhat it is
{name}-admin-token32 letters and digits, secretThe administrator's sign-in token
{name}-agent-token32 letters and digits, secretThe token agents present
  • Generated values are kept in the AppHost's user secrets, under Parameters:{name}-admin-token. Set one there, or pass a parameter of your own as adminToken or agentToken, to choose it.
  • The resource's URL is /login?t=<admin token>. The resource sets AllowTokenInUrl on the dashboard; nothing else does. The dashboard moves the browser on to an address without the token.

The environment it writes

These keys are the contract between this package and the two programs. The package references nothing of Quartz.

OnVariableValue
The dashboardQuartz__Dashboard__Authentication__ModeToken
Quartz__Dashboard__Authentication__AllowTokenInUrltrue
Quartz__Dashboard__Authentication__Tokens__Administratorthe admin token
Quartz__Dashboard__Agents__Tokens__Primarythe agent token
Quartz__Dashboard__Targets__{target}__ConnectionStringthe database's connection string
Quartz__Dashboard__Targets__{target}__Provider, TablePrefix, Serializer, ExecutionHistory, RediscoveryIntervalwhen set
OTEL_*Aspire's, so the dashboard's own telemetry reaches the Aspire dashboard
A workerQuartz__DashboardAgent__Endpoint{dashboard URL}/quartz/agents
Quartz__DashboardAgent__Tokenthe agent token
Quartz__DashboardAgent__Targetthe worker's resource name

The image

The image is ghcr.io/quartznet/quartz-dashboard at this package's version, so the two are released together. A build of the package that is not a release runs a tag that does not exist; give it one with .WithImageTag("4.8.0").

Limitations

  • One dashboard replica. It holds its agents' connections in memory; WithReplicas(n) above one splits them between replicas.
  • A worker with replicas is shown one replica at a time. Every replica registers under the same target, and the dashboard holds a target for one scheduler instance: the others are refused until it leaves. For a replicated worker, cluster its store and use WithAttachedStore, which shows the cluster and every node in it.
  • Store-attached schedulers show Quartz's own job data types; see Dashboard Host.
  • net10.0, like every Quartz 4 package.
Help us by improving this page!
Last Updated: 11/3/26, 9:04 PM
Contributors: Marko Lahma, Claude Opus 5.5
Prev
Aspire Integration
Next
ASP.NET Core Integration