Table of Contents

Class DelegatingScheduler

Namespace
Quartz.Impl
Assembly
Quartz.dll

A scheduler that forwards every member to another one, so that a decorator overrides only what it changes.

public class DelegatingScheduler : IScheduler, IAsyncDisposable
Inheritance
DelegatingScheduler
Implements
Inherited Members
Extension Methods

Remarks

Every member is virtual, and a member added to IScheduler lands here as one more forwarder — which is what keeps a decorator in somebody else's codebase compiling.

Constructors

DelegatingScheduler(IScheduler)

Wraps the scheduler this one forwards to.

public DelegatingScheduler(IScheduler scheduler)

Parameters

scheduler IScheduler

The scheduler every member is forwarded to.

Properties

Context

Returns the SchedulerContext of the IScheduler.

public virtual SchedulerContext Context { get; }

Property Value

SchedulerContext

InnerScheduler

The scheduler this one forwards to, so that code which needs the real scheduler - rather than the behaviour a decorator adds - can reach it through however many layers are in the way.

protected IScheduler InnerScheduler { get; }

Property Value

IScheduler

ListenerManager

Get a reference to the scheduler's IListenerManager, through which listeners may be registered.

public virtual IListenerManager ListenerManager { get; }

Property Value

IListenerManager

the scheduler's IListenerManager

See Also

SchedulerInstanceId

Returns the instance Id of the IScheduler.

public virtual string SchedulerInstanceId { get; }

Property Value

string

SchedulerName

Returns the name of the IScheduler.

public virtual string SchedulerName { get; }

Property Value

string

Status

Where the IScheduler is in its lifecycle.

public virtual SchedulerStatus Status { get; }

Property Value

SchedulerStatus

Remarks

The value is an 'instantaneous' snapshot: by the time it is read, the scheduler may already have moved on. A scheduler in another process answers this over the network.

See Also

TimeProvider

The clock this scheduler reads: what it calls "now" when it decides a trigger is due, and what a trigger built for it should compute its fire times from.

public virtual TimeProvider TimeProvider { get; }

Property Value

TimeProvider

Remarks

A scheduler configured with a TimeProvider of its own — a test driving one forward by hand, an application on a clock it controls — answers with that one. Code that builds a trigger for a scheduler should read the clock from the scheduler rather than reach for System, or it computes "in ten minutes" against a different clock from the one the scheduling loop will compare the answer to. That includes a job rescheduling itself from inside Execute, which reads context.Scheduler.TimeProvider.

A default implementation answers System, so a scheduler written outside this repository needs no change and reports what its triggers would have used anyway. A proxy for a scheduler in another process answers the same, and cannot do better: the clock that matters is the remote scheduler's, and it is not this process's to read.

Methods

AddCalendar(string, ICalendar, AddCalendarOptions, CancellationToken)

Add (register) the given ICalendar to the Scheduler.

public virtual ValueTask AddCalendar(string calendarName, ICalendar calendar, AddCalendarOptions options = default, CancellationToken cancellationToken = default)

Parameters

calendarName string

Name of the calendar.

calendar ICalendar

The calendar.

options AddCalendarOptions

Whether an already registered calendar of the same name may be over-written, and whether the triggers that reference it have their next fire time re-computed. Defaults to neither.

cancellationToken CancellationToken

The cancellation instruction.

Returns

ValueTask

Exceptions

ArgumentNullException

calendarName or calendar is null.

SchedulerException

The scheduler has been shut down.

ObjectAlreadyExistsException

A calendar is already registered under the same name and Replace was not asked for.

AddJob(IJobDetail, AddJobOptions, CancellationToken)

Add the given IJob to the Scheduler - with no associated ITrigger. The IJob will be 'dormant' until it is scheduled with a ITrigger, or TriggerJob(JobKey, JobDataMap?, CancellationToken) is called for it.

public virtual ValueTask AddJob(IJobDetail jobDetail, AddJobOptions options = default, CancellationToken cancellationToken = default)

Parameters

jobDetail IJobDetail

The job to store.

options AddJobOptions

Whether an already stored job of the same key may be over-written, and whether a non-durable job may be stored while it awaits a trigger. Defaults to neither.

cancellationToken CancellationToken

The cancellation instruction.

Returns

ValueTask

Remarks

The IJob must by definition be 'durable', unless StoreNonDurableWhileAwaitingScheduling is set; if it is neither, a SchedulerException is thrown.

Exceptions

ArgumentNullException

jobDetail is null.

SchedulerException

The scheduler has been shut down; or the job is not durable and StoreNonDurableWhileAwaitingScheduling was not asked for.

ObjectAlreadyExistsException

A job is already stored under the same key and Replace was not asked for.

Clear(CancellationToken)

Clears (deletes!) all scheduling data - all IJobs, ITriggers ICalendars.

public virtual ValueTask Clear(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

ValueTask

Exceptions

SchedulerException

The scheduler has been shut down.

DeleteCalendar(string, CancellationToken)

Delete the identified ICalendar from the Scheduler.

public virtual ValueTask<bool> DeleteCalendar(string calendarName, CancellationToken cancellationToken = default)

Parameters

calendarName string

Name of the calendar.

cancellationToken CancellationToken

The cancellation instruction.

Returns

ValueTask<bool>

true if the Calendar was found and deleted.

Remarks

If removal of the 
Calendar

would result in ITriggers pointing to non-existent calendars, then a SchedulerException will be thrown.

Exceptions

ArgumentNullException

calendarName is null.

SchedulerException

The scheduler has been shut down.

JobPersistenceException

A trigger still references the calendar, so removing it would leave that trigger pointing at nothing.

DeleteJob(JobKey, CancellationToken)

Delete the identified IJob from the Scheduler - and any associated ITriggers.

public virtual ValueTask<bool> DeleteJob(JobKey jobKey, CancellationToken cancellationToken = default)

Parameters

jobKey JobKey
cancellationToken CancellationToken

Returns

ValueTask<bool>

true if the Job was found and deleted.

Exceptions

ArgumentNullException

jobKey is null.

SchedulerException

The scheduler has been shut down.

DeleteJobs(GroupMatcher<JobKey>, CancellationToken)

Delete every IJobDetail in the matching groups from the Scheduler - and any associated ITriggers.

public virtual ValueTask<List<JobKey>> DeleteJobs(GroupMatcher<JobKey> matcher, CancellationToken cancellationToken = default)

Parameters

matcher GroupMatcher<JobKey>

Selects the job groups to empty. Required — there is no "delete the default group" reading of null worth risking on a destructive call.

cancellationToken CancellationToken

The cancellation instruction.

Returns

ValueTask<List<JobKey>>

The keys of the jobs this call deleted.

Remarks

The group is the correlation axis: everything belonging to one tenant, one saga or one import shares a job group, and this is how the whole of it goes in one call rather than one round trip per key — and without first listing the keys, which is a window in which another node can add one more.

Unlike PauseJobGroups(GroupMatcher<JobKey>, CancellationToken), nothing is remembered about the groups: a delete has no state to impose on a job added afterwards.

One JobDeleted(IScheduler, JobKey, CancellationToken) is raised per deleted key, and the scheduling change is signalled once for the whole call. A matcher that matched nothing raises nothing.

Exceptions

ArgumentNullException

matcher is null.

SchedulerException

The scheduler has been shut down.

See Also

DeleteJobs(IReadOnlyCollection<JobKey>, CancellationToken)

Delete the identified jobs from the Scheduler - and any associated ITriggers.

public virtual ValueTask<List<JobKey>> DeleteJobs(IReadOnlyCollection<JobKey> jobKeys, CancellationToken cancellationToken = default)

Parameters

jobKeys IReadOnlyCollection<JobKey>
cancellationToken CancellationToken

Returns

ValueTask<List<JobKey>>

The keys this call deleted, in the order they were given. A key that names no job is simply absent, never a throw — result.Count == jobKeys.Count is the "every key was found" answer, and the list itself says which ones when it is not.

Remarks

Note that while this bulk operation is likely more efficient than invoking DeleteJob(JobKey, CancellationToken) several times, it may have the adverse affect of holding data locks for a single long duration of time (rather than lots of small durations of time).

One JobDeleted(IScheduler, JobKey, CancellationToken) is raised per key the deletion applied to, and the scheduling change is signalled once for the whole call. A key that was not found raises nothing, as the single-key form raises nothing when it answers false.

Exceptions

ArgumentNullException

jobKeys is null.

SchedulerException

The scheduler has been shut down.

See Also

DisposeAsync()

Disposes the scheduler this one forwards to, whose ownership rule therefore decides what happens.

public virtual ValueTask DisposeAsync()

Returns

ValueTask

Remarks

A decorator owns nothing of its own. Override this when a subclass acquires something it has to release, and forward to base.DisposeAsync().

Exists(JobKey, CancellationToken)

Determine whether a IJob with the given identifier already exists within the scheduler.

public virtual ValueTask<bool> Exists(JobKey jobKey, CancellationToken cancellationToken = default)

Parameters

jobKey JobKey

the identifier to check for

cancellationToken CancellationToken

The cancellation instruction.

Returns

ValueTask<bool>

true if a Job exists with the given identifier

Exceptions

SchedulerException

The scheduler has been shut down.

Exists(TriggerKey, CancellationToken)

Determine whether a ITrigger with the given identifier already exists within the scheduler.

public virtual ValueTask<bool> Exists(TriggerKey triggerKey, CancellationToken cancellationToken = default)

Parameters

triggerKey TriggerKey

the identifier to check for

cancellationToken CancellationToken

The cancellation instruction.

Returns

ValueTask<bool>

true if a Trigger exists with the given identifier

Exceptions

SchedulerException

The scheduler has been shut down.

Exists(string, CancellationToken)

Determine whether an ICalendar with the given name already exists within the scheduler.

public virtual ValueTask<bool> Exists(string calendarName, CancellationToken cancellationToken = default)

Parameters

calendarName string

the name to check for

cancellationToken CancellationToken

The cancellation instruction.

Returns

ValueTask<bool>

true if a calendar is registered under the given name

Remarks

Asks the store for the name alone. GetCalendar(string, CancellationToken) answers the same question, but only by loading and deserializing the calendar — an exclusion set that can run to thousands of dates — to throw it away again.

Exceptions

SchedulerException

The scheduler has been shut down.

GetCalendar(string, CancellationToken)

Get the ICalendar instance with the given name.

public virtual ValueTask<ICalendar?> GetCalendar(string calendarName, CancellationToken cancellationToken = default)

Parameters

calendarName string
cancellationToken CancellationToken

Returns

ValueTask<ICalendar>

Exceptions

SchedulerException

The scheduler has been shut down.

GetExecutionLimits(CancellationToken)

Gets the currently configured execution group limits, or null if none are configured.

public virtual ValueTask<ExecutionLimits?> GetExecutionLimits(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Cancellation token.

Returns

ValueTask<ExecutionLimits>

A snapshot of the current execution limits, or null.

GetJobDetail(JobKey, CancellationToken)

Get the IJobDetail for the IJob instance with the given key .

public virtual ValueTask<IJobDetail?> GetJobDetail(JobKey jobKey, CancellationToken cancellationToken = default)

Parameters

jobKey JobKey
cancellationToken CancellationToken

Returns

ValueTask<IJobDetail>

Remarks

The returned JobDetail object will be a snapshot of the actual stored JobDetail. If you wish to modify the JobDetail, you must re-store the JobDetail afterward (e.g. see AddJob(IJobDetail, AddJobOptions, CancellationToken)).

Exceptions

SchedulerException

The scheduler has been shut down.

GetJobDetails(IReadOnlyCollection<JobKey>, CancellationToken)

Retrieves the given jobs in one round trip. Keys that do not exist are simply absent from the result.

public virtual ValueTask<List<IJobDetail>> GetJobDetails(IReadOnlyCollection<JobKey> jobKeys, CancellationToken cancellationToken = default)

Parameters

jobKeys IReadOnlyCollection<JobKey>

The keys of the jobs to retrieve.

cancellationToken CancellationToken

The cancellation instruction.

Returns

ValueTask<List<IJobDetail>>

Exceptions

SchedulerException

The scheduler has been shut down.

GetMetadata(CancellationToken)

Get a SchedulerMetadata object describing the settings and capabilities of the scheduler instance.

public virtual ValueTask<SchedulerMetadata> GetMetadata(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

ValueTask<SchedulerMetadata>

Remarks

Note that the data returned is an 'instantaneous' snap-shot, and that as soon as it's returned, the metadata values may be different.

GetSchedulerInstanceId(CancellationToken)

The instance Id of the IScheduler, asked asynchronously.

public virtual ValueTask<string> GetSchedulerInstanceId(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

ValueTask<string>

Remarks

The asynchronous twin of SchedulerInstanceId, and the member to call from a request path. A scheduler in this process answers with the same string either way. A proxy for a scheduler in another process — HttpScheduler — has to ask it, and the property can only do that by blocking the calling thread for the round trip; this one awaits it.

A default implementation answers SchedulerInstanceId, so a scheduler written outside this repository needs no change and reports what the property does.

GetStatus(CancellationToken)

Where the IScheduler is in its lifecycle, asked asynchronously.

public virtual ValueTask<SchedulerStatus> GetStatus(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

ValueTask<SchedulerStatus>

Remarks

The asynchronous twin of Status, and the member to call from a request path. A scheduler in this process answers with the same value either way, and the answer is as instantaneous a snapshot here as it is there. A proxy for a scheduler in another process — HttpScheduler — has to ask it, and the property can only do that by blocking the calling thread for the round trip; this one awaits it.

A default implementation answers Status, so a scheduler written outside this repository needs no change and reports what the property does.

See Also

GetTrigger(TriggerKey, CancellationToken)

Get the ITrigger instance with the given key.

public virtual ValueTask<ITrigger?> GetTrigger(TriggerKey triggerKey, CancellationToken cancellationToken = default)

Parameters

triggerKey TriggerKey
cancellationToken CancellationToken

Returns

ValueTask<ITrigger>

Remarks

The returned Trigger object will be a snap-shot of the actual stored trigger. If you wish to modify the trigger, you must re-store the trigger afterward (e.g. see RescheduleJob(TriggerKey, ITrigger, CancellationToken)).

Exceptions

SchedulerException

The scheduler has been shut down.

GetTriggerState(TriggerKey, CancellationToken)

Get the current state of the identified ITrigger.

public virtual ValueTask<TriggerState> GetTriggerState(TriggerKey triggerKey, CancellationToken cancellationToken = default)

Parameters

triggerKey TriggerKey
cancellationToken CancellationToken

Returns

ValueTask<TriggerState>

Exceptions

SchedulerException

The scheduler has been shut down.

See Also

GetTriggers(IReadOnlyCollection<TriggerKey>, CancellationToken)

Retrieves the given triggers in one round trip. Keys that do not exist are simply absent from the result.

public virtual ValueTask<List<ITrigger>> GetTriggers(IReadOnlyCollection<TriggerKey> triggerKeys, CancellationToken cancellationToken = default)

Parameters

triggerKeys IReadOnlyCollection<TriggerKey>

The keys of the triggers to retrieve.

cancellationToken CancellationToken

The cancellation instruction.

Returns

ValueTask<List<ITrigger>>

Remarks

The returned triggers are snapshots of the stored ones. If you wish to modify a trigger, you must re-store it afterward (e.g. see RescheduleJob(TriggerKey, ITrigger, CancellationToken)).

Exceptions

SchedulerException

The scheduler has been shut down.

Interrupt(JobKey, CancellationToken)

Request the cancellation, within this Scheduler instance, of all currently executing instances of the identified IJob.

public virtual ValueTask<bool> Interrupt(JobKey jobKey, CancellationToken cancellationToken = default)

Parameters

jobKey JobKey
cancellationToken CancellationToken

Returns

ValueTask<bool>

true is at least one instance of the identified job was found and interrupted.

Remarks

Interruption is cooperative. What the scheduler does is cancel the token the firing was given — CancellationToken, which is the same token Execute(IJobExecutionContext, CancellationToken) receives — so a job that never observes it runs to completion.

If more than one instance of the identified job is currently executing, the token is cancelled on each of them in turn. Cancelling runs whatever the running job registered on its token, so if one of those throws, the instances not yet reached keep running.

To interrupt one specific execution when several of the job are running, list them with QueryFireInstances(FireInstanceQuery, CancellationToken) and pass the one you mean to InterruptFireInstance(string, CancellationToken).

This method is not cluster aware. That is, it will only interrupt instances of the identified job currently executing in this scheduler instance, not across the entire cluster.

Exceptions

ArgumentNullException

jobKey is null.

OperationCanceledException

cancellationToken was cancelled part-way through, which leaves the firings already reached interrupted.

See Also

InterruptFireInstance(string, CancellationToken)

Request the cancellation, within this Scheduler instance, of the identified executing job instance.

public virtual ValueTask<bool> InterruptFireInstance(string fireInstanceId, CancellationToken cancellationToken = default)

Parameters

fireInstanceId string

the unique identifier of the job instance to be interrupted (see FireInstanceId)

cancellationToken CancellationToken

The cancellation instruction.

Returns

ValueTask<bool>

true if the identified job instance was found and interrupted.

Remarks

Interruption is cooperative, as it is for Interrupt(JobKey, CancellationToken): the firing's CancellationToken is cancelled, and a job that never observes it runs to completion.

This method is not cluster aware. That is, it will only interrupt an instance currently executing in this scheduler instance, not across the entire cluster.

Exceptions

ArgumentNullException

fireInstanceId is null.

OperationCanceledException

cancellationToken was cancelled.

See Also

PauseAll(CancellationToken)

Pause all triggers - similar to calling PauseTriggerGroups(GroupMatcher<TriggerKey>, CancellationToken) on every group, however, after using this method ResumeAll(CancellationToken) must be called to clear the scheduler's state of 'remembering' that all new triggers will be paused as they are added.

public virtual ValueTask PauseAll(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

ValueTask

Remarks

When ResumeAll(CancellationToken) is called (to un-pause), trigger misfire instructions WILL be applied.

Exceptions

SchedulerException

The scheduler has been shut down.

See Also

PauseJob(JobKey, CancellationToken)

Pause the IJobDetail with the given key - by pausing all of its current ITriggers.

public virtual ValueTask<bool> PauseJob(JobKey jobKey, CancellationToken cancellationToken = default)

Parameters

jobKey JobKey
cancellationToken CancellationToken

Returns

ValueTask<bool>

true if the job exists — including a job that currently has no triggers — false if there is no job with the given key. No listener events are raised when nothing was found.

Exceptions

ArgumentNullException

jobKey is null.

SchedulerException

The scheduler has been shut down.

PauseJobGroups(GroupMatcher<JobKey>, CancellationToken)

Pause the job groups that match - by pausing all of the ITriggers of the IJobDetails in them.

public virtual ValueTask<List<string>> PauseJobGroups(GroupMatcher<JobKey> matcher, CancellationToken cancellationToken = default)

Parameters

matcher GroupMatcher<JobKey>
cancellationToken CancellationToken

Returns

ValueTask<List<string>>

The names of the job groups that were paused by this call.

Remarks

A group, not a set of jobs, which is why this is named for groups and answers with their names where PauseJobs(IReadOnlyCollection<JobKey>, CancellationToken) answers with keys. The pause is recorded against the group itself and outlives the jobs that were in it when the call was made: it survives a restart, reaches every node of a cluster, is what IsJobGroupPaused reports, and is imposed on jobs added to the group afterwards. No list of keys can say that, and an equality matcher pauses a group that holds no job at all — which is how a caller pauses what is about to be added to it.

The Scheduler will "remember" that the groups are paused, and impose the pause on any new jobs that are added to any of those groups until it is resumed.

NOTE: There is a limitation that only exactly matched groups can be remembered as paused. For example, if there are pre-existing job in groups "aaa" and "bbb" and a matcher is given to pause groups that start with "a" then the group "aaa" will be remembered as paused and any subsequently added jobs in group "aaa" will be paused, however if a job is added to group "axx" it will not be paused, as "axx" wasn't known at the time the "group starts with a" matcher was applied. HOWEVER, if there are pre-existing groups "aaa" and "bbb" and a matcher is given to pause the group "axx" (with a group equals matcher) then no jobs will be paused, but it will be remembered that group "axx" is paused and later when a job is added in that group, it will become paused.

Exceptions

ArgumentNullException

matcher is null.

SchedulerException

The scheduler has been shut down.

See Also

PauseJobs(IReadOnlyCollection<JobKey>, CancellationToken)

Pause the IJobDetails with the given keys - by pausing all of their current ITriggers.

public virtual ValueTask<List<JobKey>> PauseJobs(IReadOnlyCollection<JobKey> jobKeys, CancellationToken cancellationToken = default)

Parameters

jobKeys IReadOnlyCollection<JobKey>
cancellationToken CancellationToken

Returns

ValueTask<List<JobKey>>

The keys this call found, in the order they were given — a job with no triggers is found and so is present. A key that names no job is simply absent, never a throw.

Remarks

One JobPaused(IScheduler, JobKey, CancellationToken) is raised per key the pause applied to, and the scheduling change is signalled once for the whole call. A key that was not found raises nothing, as the single-key form raises nothing when it answers false.

Exceptions

ArgumentNullException

jobKeys is null.

SchedulerException

The scheduler has been shut down.

See Also

PauseTrigger(TriggerKey, CancellationToken)

Pause the ITrigger with the given key.

public virtual ValueTask<bool> PauseTrigger(TriggerKey triggerKey, CancellationToken cancellationToken = default)

Parameters

triggerKey TriggerKey
cancellationToken CancellationToken

Returns

ValueTask<bool>

true if the trigger exists and was moved into the paused state by this call, false if there is no trigger with the given key, it was already paused, or it is in a state that cannot be paused (e.g. complete). No listener events are raised when nothing changed.

Exceptions

ArgumentNullException

triggerKey is null.

SchedulerException

The scheduler has been shut down.

PauseTriggerGroups(GroupMatcher<TriggerKey>, CancellationToken)

Pause the trigger groups that match, and every ITrigger in them.

public virtual ValueTask<List<string>> PauseTriggerGroups(GroupMatcher<TriggerKey> matcher, CancellationToken cancellationToken = default)

Parameters

matcher GroupMatcher<TriggerKey>
cancellationToken CancellationToken

Returns

ValueTask<List<string>>

The names of the trigger groups that were paused by this call.

Remarks

A group, not a set of triggers, which is why this is named for groups and answers with their names where PauseTriggers(IReadOnlyCollection<TriggerKey>, CancellationToken) answers with keys. The pause is recorded against the group itself and outlives the triggers that were in it when the call was made: it survives a restart, reaches every node of a cluster, is what IsTriggerGroupPaused reports, and is imposed on triggers stored into the group afterwards. No list of keys can say that, and an equality matcher pauses a group that holds no trigger at all — which is how a caller pauses what is about to be added to it.

The Scheduler will "remember" all the groups paused, and impose the pause on any new triggers that are added to any of those groups until it is resumed.

NOTE: There is a limitation that only exactly matched groups can be remembered as paused. For example, if there are pre-existing triggers in groups "aaa" and "bbb" and a matcher is given to pause groups that start with "a" then the group "aaa" will be remembered as paused and any subsequently added triggers in that group be paused, however if a trigger is added to group "axx" it will not be paused, as "axx" wasn't known at the time the "group starts with a" matcher was applied. HOWEVER, if there are pre-existing groups "aaa" and "bbb" and a matcher is given to pause the group "axx" (with a group equals matcher) then no triggers will be paused, but it will be remembered that group "axx" is paused and later when a trigger is added in that group, it will become paused.

Exceptions

ArgumentNullException

matcher is null.

SchedulerException

The scheduler has been shut down.

See Also

PauseTriggers(IReadOnlyCollection<TriggerKey>, CancellationToken)

Pause the ITriggers with the given keys.

public virtual ValueTask<List<TriggerKey>> PauseTriggers(IReadOnlyCollection<TriggerKey> triggerKeys, CancellationToken cancellationToken = default)

Parameters

triggerKeys IReadOnlyCollection<TriggerKey>
cancellationToken CancellationToken

Returns

ValueTask<List<TriggerKey>>

The keys this call moved into the paused state, in the order they were given. A key that names no trigger, one that was already paused, and one in a state that cannot be paused are each simply absent, never a throw.

Remarks

One TriggerPaused(IScheduler, TriggerKey, CancellationToken) is raised per key the pause applied to, and the scheduling change is signalled once for the whole call. A key that did not move raises nothing, as the single-key form raises nothing when it answers false.

Exceptions

ArgumentNullException

triggerKeys is null.

SchedulerException

The scheduler has been shut down.

See Also

QueryCalendarNames(CalendarQuery, CancellationToken)

Lists calendar names matching the query, ordered by name (ordinal).

public virtual ValueTask<PagedResult<string>> QueryCalendarNames(CalendarQuery query, CancellationToken cancellationToken = default)

Parameters

query CalendarQuery

Which names to select and which page of them to return.

cancellationToken CancellationToken

The cancellation instruction.

Returns

ValueTask<PagedResult<string>>

Exceptions

SchedulerException

The scheduler has been shut down.

QueryClusterNodes(CancellationToken)

Lists the scheduler nodes the job store knows about, as ClusterNodes — this node first, then the rest by instance id.

public virtual ValueTask<List<ClusterNode>> QueryClusterNodes(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

The cancellation instruction.

Returns

ValueTask<List<ClusterNode>>

Remarks

This node is always listed, and is the only one whose IsCurrentNode is true; its InstanceId is SchedulerInstanceId. A scheduler that is not clustered — the in-memory store, or a persistent one with clustering switched off — answers with that single node and no check-in times, which is the truthful answer rather than an empty list.

The states are what this node believes, read off its own clock against the check-in stamps the other nodes wrote, and they are decided by the same predicate cluster recovery applies. A node reported Failed has its in-flight work taken over on the next check-in pass, after which it stops being listed.

The result is an 'instantaneous' snapshot: by the time it is returned a node may have checked in or been swept away. Join it with QueryFireInstances(FireInstanceQuery, CancellationToken) on SchedulerInstanceId to see what each node is running.

Exceptions

SchedulerException

The scheduler has been shut down.

See Also

QueryFireInstances(FireInstanceQuery, CancellationToken)

Lists the firings the scheduler knows about — by default the ones that are running — as FireInstances.

public virtual ValueTask<PagedResult<FireInstance>> QueryFireInstances(FireInstanceQuery query, CancellationToken cancellationToken = default)

Parameters

query FireInstanceQuery

What to select and which page of it to return.

cancellationToken CancellationToken

The cancellation instruction.

Returns

ValueTask<PagedResult<FireInstance>>

Remarks

With a persistent job store this sees the whole cluster, not just this node, because a firing is a durable record rather than process-local state. Filter by SchedulerInstanceId to ask about one node — SchedulerInstanceId for this one.

The result is an 'instantaneous' snapshot: by the time it is returned, firings may have started or finished.

A firing an ITriggerListener vetoes does not linger here: applying the veto completes the firing, which removes it. It can be listed for the instant between the store recording the firing and the veto being decided, and never after.

Exceptions

SchedulerException

The scheduler has been shut down.

See Also

QueryJobGroups(JobGroupQuery, CancellationToken)

Lists job groups matching the query, ordered by name (ordinal).

public virtual ValueTask<PagedResult<JobGroup>> QueryJobGroups(JobGroupQuery query, CancellationToken cancellationToken = default)

Parameters

query JobGroupQuery

What to select and which page of it to return.

cancellationToken CancellationToken

The cancellation instruction.

Returns

ValueTask<PagedResult<JobGroup>>

Exceptions

SchedulerException

The scheduler has been shut down.

QueryJobs(JobQuery, CancellationToken)

Lists jobs matching the query, as JobHeaders, ordered by group and then name (ordinal). Listing never loads job data.

public virtual ValueTask<PagedResult<JobHeader>> QueryJobs(JobQuery query, CancellationToken cancellationToken = default)

Parameters

query JobQuery

What to select and which page of it to return.

cancellationToken CancellationToken

The cancellation instruction.

Returns

ValueTask<PagedResult<JobHeader>>

Exceptions

SchedulerException

The scheduler has been shut down.

QueryTriggerGroups(TriggerGroupQuery, CancellationToken)

Lists trigger groups matching the query, ordered by name (ordinal).

public virtual ValueTask<PagedResult<TriggerGroup>> QueryTriggerGroups(TriggerGroupQuery query, CancellationToken cancellationToken = default)

Parameters

query TriggerGroupQuery

What to select and which page of it to return.

cancellationToken CancellationToken

The cancellation instruction.

Returns

ValueTask<PagedResult<TriggerGroup>>

Exceptions

SchedulerException

The scheduler has been shut down.

QueryTriggers(TriggerQuery, CancellationToken)

Lists triggers matching the query, as TriggerHeaders, ordered by group and then name (ordinal). The header carries the trigger's current state and execution group, so listing callers need no further round trips.

public virtual ValueTask<PagedResult<TriggerHeader>> QueryTriggers(TriggerQuery query, CancellationToken cancellationToken = default)

Parameters

query TriggerQuery

What to select and which page of it to return.

cancellationToken CancellationToken

The cancellation instruction.

Returns

ValueTask<PagedResult<TriggerHeader>>

Exceptions

SchedulerException

The scheduler has been shut down.

RescheduleJob(TriggerKey, ITrigger, CancellationToken)

Remove (delete) the ITrigger with the given key, and store the new given one - which must be associated with the same job (the new trigger must have the job name & group specified)

  • however, the new trigger need not have the same name as the old trigger.
public virtual ValueTask<DateTimeOffset?> RescheduleJob(TriggerKey triggerKey, ITrigger newTrigger, CancellationToken cancellationToken = default)

Parameters

triggerKey TriggerKey

The ITrigger to be replaced.

newTrigger ITrigger

The new ITrigger to be stored.

cancellationToken CancellationToken

The cancellation instruction.

Returns

ValueTask<DateTimeOffset?>

null if a ITrigger with the given name and group was not found and removed from the store (and the new trigger is therefore not stored), otherwise the first fire time of the newly scheduled trigger.

Exceptions

ArgumentNullException

triggerKey or newTrigger is null.

SchedulerException

The scheduler has been shut down; or newTrigger names a calendar that is not registered, or will never fire; or it is not one of Quartz's own trigger implementations.

ResetTriggerFromErrorState(TriggerKey, CancellationToken)

Reset the current state of the identified ITrigger from Error to Normal or Paused as appropriate.

public virtual ValueTask<bool> ResetTriggerFromErrorState(TriggerKey triggerKey, CancellationToken cancellationToken = default)

Parameters

triggerKey TriggerKey
cancellationToken CancellationToken

Returns

ValueTask<bool>

true if the trigger existed in the Error state and was reset by this call, false if there is no trigger with the given key or it was not in the error state.

Remarks

Only affects triggers that are in Error state - if identified trigger is not in that state then the result is a no-op.

The result will be the trigger returning to the normal, waiting to be fired state, unless the trigger's group has been paused, in which case it will go into the Paused state.

Exceptions

ArgumentNullException

triggerKey is null.

SchedulerException

The scheduler has been shut down.

See Also

ResetTriggersFromErrorState(GroupMatcher<TriggerKey>, CancellationToken)

Forwards the group form rather than letting IScheduler's default implementation run here.

public virtual ValueTask<List<TriggerKey>> ResetTriggersFromErrorState(GroupMatcher<TriggerKey> matcher, CancellationToken cancellationToken = default)

Parameters

matcher GroupMatcher<TriggerKey>
cancellationToken CancellationToken

Returns

ValueTask<List<TriggerKey>>

Remarks

A default interface member is not inherited into a class's member set, so a decorator that does not declare it lets the interface default execute on the decorator — decomposing into a query and a second call, both of which come back through this class. That happens to give the right answer for this member, and it is the wrong shape to rely on: an inner scheduler that can reset a group in one statement never gets asked to, a listening decorator sees two calls where one was made, and the first default whose decomposition is not equivalent would be a live bug. DelegatingForwardingTest holds every member of the interface to being declared here.

ResetTriggersFromErrorState(IReadOnlyCollection<TriggerKey>, CancellationToken)

Reset every one of the identified ITriggers from Error to Normal or Paused as appropriate.

public virtual ValueTask<List<TriggerKey>> ResetTriggersFromErrorState(IReadOnlyCollection<TriggerKey> triggerKeys, CancellationToken cancellationToken = default)

Parameters

triggerKeys IReadOnlyCollection<TriggerKey>
cancellationToken CancellationToken

Returns

ValueTask<List<TriggerKey>>

The keys this call reset, in the order they were given. A key that names no trigger, or one that was not in the Error state, is simply absent, never a throw.

Remarks

The set is reset in one pass, under one lock or one connection. Resetting raises no scheduler-listener event and signals no scheduling change, in the plural exactly as in the singular — the reset triggers are picked up by the next acquisition cycle.

Exceptions

ArgumentNullException

triggerKeys is null.

SchedulerException

The scheduler has been shut down.

See Also

ResumeAll(CancellationToken)

Resume (un-pause) all triggers - similar to calling ResumeTriggerGroups(GroupMatcher<TriggerKey>, CancellationToken) on every group.

public virtual ValueTask ResumeAll(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

ValueTask

Remarks

If any ITrigger missed one or more fire-times, then the ITrigger's misfire instruction will be applied.

Exceptions

SchedulerException

The scheduler has been shut down.

See Also

ResumeJob(JobKey, CancellationToken)

Resume (un-pause) the IJobDetail with the given key.

public virtual ValueTask<bool> ResumeJob(JobKey jobKey, CancellationToken cancellationToken = default)

Parameters

jobKey JobKey
cancellationToken CancellationToken

Returns

ValueTask<bool>

true if the job exists — including a job that currently has no triggers — false if there is no job with the given key. No listener events are raised when nothing was found.

Remarks

If any of the IJob'sITrigger s missed one or more fire-times, then the ITrigger's misfire instruction will be applied.

Exceptions

ArgumentNullException

jobKey is null.

SchedulerException

The scheduler has been shut down.

ResumeJobGroups(GroupMatcher<JobKey>, CancellationToken)

Resume (un-pause) the job groups that match, and the IJobDetails in them.

public virtual ValueTask<List<string>> ResumeJobGroups(GroupMatcher<JobKey> matcher, CancellationToken cancellationToken = default)

Parameters

matcher GroupMatcher<JobKey>
cancellationToken CancellationToken

Returns

ValueTask<List<string>>

The names of the job groups that were resumed by this call.

Remarks

Forgets the group's pause, whatever matcher recorded it, so a group paused by a prefix matcher is resumed by one — which is why this answers with group names, as PauseJobGroups(GroupMatcher<JobKey>, CancellationToken) does, rather than with the keys ResumeJobs(IReadOnlyCollection<JobKey>, CancellationToken) answers with.

If any of the IJob s had ITrigger s that missed one or more fire-times, then the ITrigger's misfire instruction will be applied.

Exceptions

ArgumentNullException

matcher is null.

SchedulerException

The scheduler has been shut down.

See Also

ResumeJobs(IReadOnlyCollection<JobKey>, CancellationToken)

Resume (un-pause) the IJobDetails with the given keys.

public virtual ValueTask<List<JobKey>> ResumeJobs(IReadOnlyCollection<JobKey> jobKeys, CancellationToken cancellationToken = default)

Parameters

jobKeys IReadOnlyCollection<JobKey>
cancellationToken CancellationToken

Returns

ValueTask<List<JobKey>>

The keys this call found, in the order they were given — a job with no triggers is found and so is present. A key that names no job is simply absent, never a throw.

Remarks

If any of the jobs' ITriggers missed one or more fire-times, then those triggers' misfire instructions will be applied.

One JobResumed(IScheduler, JobKey, CancellationToken) is raised per key the resume applied to, and the scheduling change is signalled once for the whole call. A key that was not found raises nothing.

Exceptions

ArgumentNullException

jobKeys is null.

SchedulerException

The scheduler has been shut down.

See Also

ResumeTrigger(TriggerKey, CancellationToken)

Resume (un-pause) the ITrigger with the given key.

public virtual ValueTask<bool> ResumeTrigger(TriggerKey triggerKey, CancellationToken cancellationToken = default)

Parameters

triggerKey TriggerKey
cancellationToken CancellationToken

Returns

ValueTask<bool>

true if the trigger existed in a paused state and was resumed by this call, false if there is no trigger with the given key or it was not paused. No listener events are raised when nothing changed.

Remarks

If the ITrigger missed one or more fire-times, then the ITrigger's misfire instruction will be applied.

Exceptions

ArgumentNullException

triggerKey is null.

SchedulerException

The scheduler has been shut down.

ResumeTriggerGroups(GroupMatcher<TriggerKey>, CancellationToken)

Resume (un-pause) the trigger groups that match, and every ITrigger in them.

public virtual ValueTask<List<string>> ResumeTriggerGroups(GroupMatcher<TriggerKey> matcher, CancellationToken cancellationToken = default)

Parameters

matcher GroupMatcher<TriggerKey>
cancellationToken CancellationToken

Returns

ValueTask<List<string>>

The names of the trigger groups that were resumed by this call.

Remarks

Forgets the group's pause, whatever matcher recorded it, so a group paused by a prefix matcher is resumed by one — which is why this answers with group names, as PauseTriggerGroups(GroupMatcher<TriggerKey>, CancellationToken) does, rather than with the keys ResumeTriggers(IReadOnlyCollection<TriggerKey>, CancellationToken) answers with.

If any ITrigger missed one or more fire-times, then the ITrigger's misfire instruction will be applied.

Exceptions

ArgumentNullException

matcher is null.

SchedulerException

The scheduler has been shut down.

See Also

ResumeTriggers(IReadOnlyCollection<TriggerKey>, CancellationToken)

Resume (un-pause) the ITriggers with the given keys.

public virtual ValueTask<List<TriggerKey>> ResumeTriggers(IReadOnlyCollection<TriggerKey> triggerKeys, CancellationToken cancellationToken = default)

Parameters

triggerKeys IReadOnlyCollection<TriggerKey>
cancellationToken CancellationToken

Returns

ValueTask<List<TriggerKey>>

The keys this call resumed, in the order they were given. A key that names no trigger, and one that was not paused, are each simply absent, never a throw.

Remarks

If a ITrigger missed one or more fire-times, then its misfire instruction will be applied.

One TriggerResumed(IScheduler, TriggerKey, CancellationToken) is raised per key the resume applied to, and the scheduling change is signalled once for the whole call. A key that did not move raises nothing.

Exceptions

ArgumentNullException

triggerKeys is null.

SchedulerException

The scheduler has been shut down.

See Also

ScheduleJob(IJobDetail, ITrigger, ScheduleJobOptions, CancellationToken)

Add the given IJobDetail to the Scheduler, and associate the given ITrigger with it.

public virtual ValueTask<DateTimeOffset> ScheduleJob(IJobDetail jobDetail, ITrigger trigger, ScheduleJobOptions options = default, CancellationToken cancellationToken = default)

Parameters

jobDetail IJobDetail

The job to store.

trigger ITrigger

The trigger to store.

options ScheduleJobOptions

Whether an already stored job or trigger with the same key is over-written. The whole operation is one store operation under one lock, so an upsert needs no read-then-write of its own and cannot lose a race with another node doing the same thing.

cancellationToken CancellationToken

The cancellation instruction.

Returns

ValueTask<DateTimeOffset>

Remarks

If the given Trigger does not reference any IJob, then it will be set to reference the Job passed with it into this method.

Exceptions

ArgumentNullException

jobDetail or trigger is null.

SchedulerException

The scheduler has been shut down; or trigger names a different job, names a calendar that is not registered, or will never fire; or it is not one of Quartz's own trigger implementations.

ObjectAlreadyExistsException

The job or the trigger is already stored under the same key and Replace was not asked for.

ScheduleJob(IJobDetail, IReadOnlyCollection<ITrigger>, ScheduleJobOptions, CancellationToken)

Schedule the given job with the related set of triggers.

public virtual ValueTask ScheduleJob(IJobDetail jobDetail, IReadOnlyCollection<ITrigger> triggersForJob, ScheduleJobOptions options = default, CancellationToken cancellationToken = default)

Parameters

jobDetail IJobDetail
triggersForJob IReadOnlyCollection<ITrigger>
options ScheduleJobOptions
cancellationToken CancellationToken

Returns

ValueTask

Remarks

If any of the given job or triggers already exist (or more specifically, if the keys are not unique) and Replace is not set then an exception will be thrown.

Exceptions

ArgumentNullException

jobDetail or triggersForJob is null.

SchedulerException

The scheduler has been shut down.

ObjectAlreadyExistsException

The job or one of the triggers is already stored under the same key and Replace was not asked for. Nothing is stored.

ScheduleJob(ITrigger, ScheduleJobOptions, CancellationToken)

Schedule the given ITrigger with the IJob identified by the ITrigger's settings.

public virtual ValueTask<DateTimeOffset> ScheduleJob(ITrigger trigger, ScheduleJobOptions options = default, CancellationToken cancellationToken = default)

Parameters

trigger ITrigger

The trigger to store.

options ScheduleJobOptions

Whether an already stored trigger with the same key is over-written. Replacing is one store operation under the store's own lock, so scheduling over an existing trigger needs no CheckExists / UnscheduleJob / ScheduleJob dance and cannot lose a race with another node doing the same thing.

cancellationToken CancellationToken

The cancellation instruction.

Returns

ValueTask<DateTimeOffset>

Remarks

A replaced trigger keeps its PreviousFireTimeUtc, so a job that reads PreviousFireTimeUtc is not told the schedule has never fired merely because its trigger was rewritten.

Exceptions

ArgumentNullException

trigger is null.

SchedulerException

The scheduler has been shut down; or trigger names a calendar that is not registered, or will never fire; or it is not one of Quartz's own trigger implementations.

ObjectAlreadyExistsException

A trigger is already stored under the same key and Replace was not asked for.

ScheduleJobs(IReadOnlyDictionary<IJobDetail, IReadOnlyCollection<ITrigger>>, ScheduleJobOptions, CancellationToken)

Schedule all the given jobs with the related set of triggers.

public virtual ValueTask ScheduleJobs(IReadOnlyDictionary<IJobDetail, IReadOnlyCollection<ITrigger>> triggersAndJobs, ScheduleJobOptions options = default, CancellationToken cancellationToken = default)

Parameters

triggersAndJobs IReadOnlyDictionary<IJobDetail, IReadOnlyCollection<ITrigger>>
options ScheduleJobOptions
cancellationToken CancellationToken

Returns

ValueTask

Remarks

If any of the given jobs or triggers already exist (or more specifically, if the keys are not unique) and Replace is not set then an exception will be thrown.

Exceptions

ArgumentNullException

triggersAndJobs is null.

SchedulerException

The scheduler has been shut down.

ObjectAlreadyExistsException

A key in the batch is already stored and Replace was not asked for. None of the batch is stored.

SetExecutionLimits(ExecutionLimits?, CancellationToken)

Sets the execution group limits this scheduler enforces. Execution groups allow thread limits - per node or across the cluster, as each limit's ExecutionLimitScope says - so that resource-intensive jobs do not saturate all available threads.

public virtual ValueTask SetExecutionLimits(ExecutionLimits? limits, CancellationToken cancellationToken = default)

Parameters

limits ExecutionLimits

The execution limits to apply, or null to clear.

cancellationToken CancellationToken

Cancellation token.

Returns

ValueTask

Remarks

Limits take effect on the next trigger acquisition cycle. Pass null to clear all limits.

Shutdown(bool, CancellationToken)

Halts the IScheduler's firing of ITriggers, and cleans up all resources associated with the Scheduler.

public virtual ValueTask Shutdown(bool waitForJobsToComplete = false, CancellationToken cancellationToken = default)

Parameters

waitForJobsToComplete bool

if true the scheduler will not allow this method to return until all currently executing jobs have completed. If false it waits for no job, but still gives the executions already in flight a couple of seconds to report their completions, so that a firing which ends on the way out is recorded rather than left for a peer to recover; one still working when that window closes is abandoned.

cancellationToken CancellationToken

Bounds the wait for running jobs, so that a shutdown can be given a deadline. Cancelling it stops the scheduler waiting; it does not cancel the jobs, and the shutdown itself always runs to the end, so the job store, the plugins and the listeners are told the scheduler has stopped either way.

Returns

ValueTask

Remarks

The scheduler cannot be re-started.

The scheduler is ShuttingDown for the duration and Shutdown once its plugins and job store are down. It does not pass through Standby on the way, and no listener is told it stood down: a scheduler being torn down is not one waiting to be started again.

Firing stops before anything is torn down, so a trigger this scheduler had reserved is released for another node and one it had already fired is still run. What it does about the executions under way is waitForJobsToComplete's answer.

Standby(CancellationToken)

Temporarily halts the IScheduler's firing of ITriggers.

public virtual ValueTask Standby(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

ValueTask

Remarks

When Start(CancellationToken) is called (to bring the scheduler out of stand-by mode), trigger misfire instructions will NOT be applied during the execution of the Start(CancellationToken) method - any misfires will be detected immediately afterward (by the IJobStore's normal process).

The scheduler is not destroyed, and can be re-started at any time. A scheduler that is running becomes Standby.

Standing down a scheduler that is not running does nothing at all: no listener is told it went into standby, and the job store is not told it paused, because neither happened. A scheduler that has never been started is already firing nothing and stays Created, which is the more precise answer than standby; one already in standby is in the state being asked for.

Exceptions

SchedulerException

The scheduler has been shut down, or is shutting down. Neither is a state to be stood down from.

See Also

Start(CancellationToken)

Starts the IScheduler's threads that fire ITriggers, taking it to Running. A newly built scheduler is Created and fires nothing until this is called; so is one that Standby(CancellationToken) has stood down.

public virtual ValueTask Start(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

ValueTask

Remarks

The misfire/recovery process will be started, if it is the initial call to this method on this scheduler instance.

Starting a scheduler that is already Running does nothing at all: no listener is told the scheduler started, and the job store is not told it resumed, because neither happened.

Exceptions

SchedulerException

The scheduler has been shut down, or is shutting down. That is terminal, so there is nothing to start.

See Also

StartDelayed(TimeSpan, CancellationToken)

Calls Start(CancellationToken) after the indicated delay. (This call does not block). This can be useful within applications that have initializers that create the scheduler immediately, before the resources needed by the executing jobs have been fully initialized.

public virtual ValueTask StartDelayed(TimeSpan delay, CancellationToken cancellationToken = default)

Parameters

delay TimeSpan
cancellationToken CancellationToken

Returns

ValueTask

Exceptions

SchedulerException

The scheduler has been shut down, and cannot be restarted.

ArgumentOutOfRangeException

delay is negative, or longer than a timer will wait.

See Also

TriggerJob(JobKey, JobDataMap?, CancellationToken)

Trigger the identified IJobDetail (Execute it now).

public virtual ValueTask TriggerJob(JobKey jobKey, JobDataMap? data = null, CancellationToken cancellationToken = default)

Parameters

jobKey JobKey

The JobKey of the IJob to be executed.

data JobDataMap

the (possibly null) JobDataMap to be associated with the trigger that fires the job immediately.

cancellationToken CancellationToken

The cancellation instruction.

Returns

ValueTask

Exceptions

ArgumentNullException

jobKey is null.

SchedulerException

The scheduler has been shut down.

JobPersistenceException

No job is stored under jobKey.

UnscheduleJob(TriggerKey, CancellationToken)

Remove the indicated ITrigger from the scheduler.

If the related job does not have any other triggers, and the job is not durable, then the job will also be deleted.

public virtual ValueTask<bool> UnscheduleJob(TriggerKey triggerKey, CancellationToken cancellationToken = default)

Parameters

triggerKey TriggerKey
cancellationToken CancellationToken

Returns

ValueTask<bool>

Exceptions

ArgumentNullException

triggerKey is null.

SchedulerException

The scheduler has been shut down.

UnscheduleJobs(GroupMatcher<TriggerKey>, CancellationToken)

Remove every ITrigger in the matching groups from the scheduler.

public virtual ValueTask<List<TriggerKey>> UnscheduleJobs(GroupMatcher<TriggerKey> matcher, CancellationToken cancellationToken = default)

Parameters

matcher GroupMatcher<TriggerKey>

Selects the trigger groups to empty. Required — there is no "unschedule the default group" reading of null worth risking on a destructive call.

cancellationToken CancellationToken

The cancellation instruction.

Returns

ValueTask<List<TriggerKey>>

The keys of the triggers this call removed.

Remarks

The group is the correlation axis: everything scheduled for one saga, one tenant or one conversation shares a trigger group, and this is how the whole of it is called off in one call rather than one round trip per key — and without first listing the keys, which is a window in which another node can add one more.

A job left with no triggers by the removal is deleted too if it is not durable, exactly as the single-key UnscheduleJob(TriggerKey, CancellationToken) does, but the answer names triggers only.

One JobUnscheduled(IScheduler, TriggerKey, CancellationToken) is raised per removed key, and the scheduling change is signalled once for the whole call. A matcher that matched nothing raises nothing.

Exceptions

ArgumentNullException

matcher is null.

SchedulerException

The scheduler has been shut down.

See Also

UnscheduleJobs(IReadOnlyCollection<TriggerKey>, CancellationToken)

Remove all of the indicated ITriggers from the scheduler.

public virtual ValueTask<List<TriggerKey>> UnscheduleJobs(IReadOnlyCollection<TriggerKey> triggerKeys, CancellationToken cancellationToken = default)

Parameters

triggerKeys IReadOnlyCollection<TriggerKey>
cancellationToken CancellationToken

Returns

ValueTask<List<TriggerKey>>

The keys this call removed, in the order they were given. A key that names no trigger is simply absent, never a throw — result.Count == triggerKeys.Count is the "every key was found" answer, and the list itself says which ones when it is not.

Remarks

If the related job does not have any other triggers, and the job is not durable, then the job will also be deleted.

Note that while this bulk operation is likely more efficient than invoking UnscheduleJob(TriggerKey, CancellationToken) several times, it may have the adverse affect of holding data locks for a single long duration of time (rather than lots of small durations of time).

One JobUnscheduled(IScheduler, TriggerKey, CancellationToken) is raised per key the removal applied to, and the scheduling change is signalled once for the whole call. A key that was not found raises nothing, as the single-key form raises nothing when it answers false.

Exceptions

ArgumentNullException

triggerKeys is null.

SchedulerException

The scheduler has been shut down.

See Also

UpdateTriggerDetails(TriggerKey, TriggerDetailsUpdate, CancellationToken)

Updates trigger metadata and selected settings without rescheduling. Fire times and trigger state are preserved. Supported properties are the description, priority, job data map, calendar name, misfire instruction, execution group and preferred node.

public virtual ValueTask<bool> UpdateTriggerDetails(TriggerKey triggerKey, TriggerDetailsUpdate update, CancellationToken cancellationToken = default)

Parameters

triggerKey TriggerKey

The key identifying the trigger to update.

update TriggerDetailsUpdate

The details to update. See TriggerDetailsUpdate for available properties.

cancellationToken CancellationToken

The cancellation instruction.

Returns

ValueTask<bool>

true if the trigger was found and updated, false if not found.

Exceptions

ArgumentNullException

triggerKey or update is null.

SchedulerException

The scheduler has been shut down.