liveBook · Manning

Scheduler

As explained in ASP.NET Core in Action, 3e

A scheduler is the Quartz.NET runtime component that tracks triggers, creates jobs through a job factory, and executes them.

A Quartz.NET scheduler runs background jobs according to triggers. It tracks schedules, creates job instances through a job factory, and executes them as a hosted background service. section 34.3 section 34.3.1

Quartz.NET coordinates four related pieces:

  • Jobs implement the task logic through the IJob interface. section 34.3 section 34.3.1
  • Triggers determine when jobs run, such as every five minutes or on a calendar schedule. section 34.3
  • The job factory creates job instances and can retrieve implementations from dependency injection. section 34.3 section 34.3.1
  • The hosted service starts the scheduler with the application and can wait for running jobs during shutdown. section 34.3.1
Listing 34.10 Configuring Quartz.NET
using Quartz;
 
IHost host = Host.CreateDefaultBuilder(args)
    .ConfigureServices((hostContext, services) =>            #1
    {
        services.AddQuartz(q =>                              #2
        {
            q. UseMicrosoftDependencyInjectionJobFactory();  #3
        });
 
        services.AddQuartzHostedService(                     #4
            q => q.WaitForJobsToComplete = true);            #4
    })
    .Build();
host.Run();

Configure Quartz.NET with dependency injection and register its hosted service; the scheduler then starts when the application starts. section 34.3.1

How ASP.NET Core in Action, 3e covers it

How deep it goes
Explains scheduler components and hosted-service installation, stopping before configuring concrete jobs and triggers.
Examples
Uses a generic-host configuration listing and an exchange-rate downloader converted into a Quartz.NET job.
What it assumes
Assumes a .NET application and introduces Quartz.NET installation, IJob, hosted services, and dependency-injection configuration.
What you can do after
Configure Quartz.NET as a hosted background service in a .NET application using dependency injection.
How it connects
Connects jobs, triggers, job factories, dependency injection, hosted services, and clustering.

Also explained in

Compare how 12 books explain scheduler →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of ASP.NET Core in Action, 3e. The section links point to the parts of the book it draws on.