Table of Contents

Class QuartzHostedServiceOptions

Namespace
Quartz
Assembly
Quartz.dll

How QuartzHostedService starts and stops one scheduler.

public sealed class QuartzHostedServiceOptions
Inheritance
QuartzHostedServiceOptions
Inherited Members

Remarks

Named options, one instance per scheduler name, so a host running several schedulers can start each on its own terms.

Properties

AutoStart

If true (the default) the hosted service starts the scheduler. Set it to false to have the scheduler built, initialized and bound but left in Created, for the application to start when it is ready.

public bool AutoStart { get; set; }

Property Value

bool

Remarks

A library that owns its own leader election, or a module that has work to do before anything may fire, wants the container to produce a scheduler without the host pressing start. The scheduler is still created and bound, so ISchedulerRegistry, the dashboard and the HTTP API all see it; it simply is not running until something calls Start(CancellationToken).

This wins over AwaitApplicationStarted and StartDelay: both describe when the hosted service starts a scheduler, and it does not start this one at all.

Shutdown is unaffected. The hosted service shuts down every scheduler it created, started or not, so opting out of the start is not opting out of the stop.

AwaitApplicationStarted

If true (default), jobs will not be started until application startup completes. This avoids the running of jobs during application startup.

public bool AwaitApplicationStarted { get; set; }

Property Value

bool

StartDelay

If not null the scheduler will start after specified delay.

If AwaitApplicationStarted is true, the delay starts when application startup completes.

public TimeSpan? StartDelay { get; set; }

Property Value

TimeSpan?

WaitForJobsToComplete

If true the scheduler will not allow shutdown process to return until all currently executing jobs have completed.

public bool WaitForJobsToComplete { get; set; }

Property Value

bool