Table of Contents

Class SchedulerQueryExtensions

Namespace
Quartz
Assembly
Quartz.dll

Convenience calls built on the IScheduler query members.

public static class SchedulerQueryExtensions
Inheritance
SchedulerQueryExtensions
Inherited Members

Remarks

Reading has two altitudes on purpose, and this is the lower one. IScheduler's Query* members take a query record — a filter, a page, an optional total count — and answer with headers rich enough to render a listing. The calls here are the questions that need none of that: they name no record, take no page, and answer with the bare keys and names a caller who already knows what it wants is asking for. Neither family is the other's leftovers — the query members cannot be as short as these, and these cannot page.

The price of the shortness is that every Get* listing here enumerates its whole result. There is no paging: a scheduler with many jobs, triggers or groups pays for all of them on each call. Use the query member with Skip and Take when the result may be large.

What does not live here is a shorthand that saves only the new: QueryJobs(new JobQuery()) is not worth an overload, because the record it names is the query API's whole point. QueryTriggersInError(IScheduler, CancellationToken) stays because it is a preset rather than a synonym — it knows the filter, and "which triggers are broken?" is a question, where "the jobs, unfiltered" is just a call with an argument left out.

Methods

GetCalendarNames(IScheduler, CancellationToken)

Get the names of all registered ICalendars.

public static ValueTask<List<string>> GetCalendarNames(this IScheduler scheduler, CancellationToken cancellationToken = default)

Parameters

scheduler IScheduler

The scheduler to query.

cancellationToken CancellationToken

The cancellation instruction.

Returns

ValueTask<List<string>>

Remarks

Enumerates every calendar name. For paged access use QueryCalendarNames(CalendarQuery, CancellationToken).

GetJobGroupNames(IScheduler, CancellationToken)

Get the names of all known IJobDetail groups.

public static ValueTask<List<string>> GetJobGroupNames(this IScheduler scheduler, CancellationToken cancellationToken = default)

Parameters

scheduler IScheduler

The scheduler to query.

cancellationToken CancellationToken

The cancellation instruction.

Returns

ValueTask<List<string>>

Remarks

Enumerates every group. For paged access, and for each group's paused state, use QueryJobGroups(JobGroupQuery, CancellationToken).

GetJobKeys(IScheduler, GroupMatcher<JobKey>, CancellationToken)

Get the keys of all the IJobDetails in the matching groups.

public static ValueTask<List<JobKey>> GetJobKeys(this IScheduler scheduler, GroupMatcher<JobKey> matcher, CancellationToken cancellationToken = default)

Parameters

scheduler IScheduler

The scheduler to query.

matcher GroupMatcher<JobKey>

Limits the result to jobs whose group matches.

cancellationToken CancellationToken

The cancellation instruction.

Returns

ValueTask<List<JobKey>>

Remarks

Enumerates every matching job. For paged access, and for the job metadata a listing usually needs, use QueryJobs(JobQuery, CancellationToken).

GetPausedTriggerGroups(IScheduler, CancellationToken)

Get the names of all ITrigger groups that are paused.

public static ValueTask<List<string>> GetPausedTriggerGroups(this IScheduler scheduler, CancellationToken cancellationToken = default)

Parameters

scheduler IScheduler

The scheduler to query.

cancellationToken CancellationToken

The cancellation instruction.

Returns

ValueTask<List<string>>

Remarks

Enumerates every paused group. For paged access use QueryTriggerGroups(TriggerGroupQuery, CancellationToken) with Paused set.

GetTriggerGroupNames(IScheduler, CancellationToken)

Get the names of all known ITrigger groups.

public static ValueTask<List<string>> GetTriggerGroupNames(this IScheduler scheduler, CancellationToken cancellationToken = default)

Parameters

scheduler IScheduler

The scheduler to query.

cancellationToken CancellationToken

The cancellation instruction.

Returns

ValueTask<List<string>>

Remarks

Enumerates every group. For paged access, and for each group's paused state, use QueryTriggerGroups(TriggerGroupQuery, CancellationToken).

GetTriggerKeys(IScheduler, GroupMatcher<TriggerKey>, CancellationToken)

Get the keys of all the ITriggers in the matching groups.

public static ValueTask<List<TriggerKey>> GetTriggerKeys(this IScheduler scheduler, GroupMatcher<TriggerKey> matcher, CancellationToken cancellationToken = default)

Parameters

scheduler IScheduler

The scheduler to query.

matcher GroupMatcher<TriggerKey>

Limits the result to triggers whose group matches.

cancellationToken CancellationToken

The cancellation instruction.

Returns

ValueTask<List<TriggerKey>>

Remarks

Enumerates every matching trigger. For paged access, and for the state and fire times a listing usually needs, use QueryTriggers(TriggerQuery, CancellationToken).

GetTriggersOfJob(IScheduler, JobKey, CancellationToken)

Get all ITriggers that are associated with the identified IJobDetail.

public static ValueTask<List<ITrigger>> GetTriggersOfJob(this IScheduler scheduler, JobKey jobKey, CancellationToken cancellationToken = default)

Parameters

scheduler IScheduler

The scheduler to query.

jobKey JobKey

The job whose triggers to return.

cancellationToken CancellationToken

The cancellation instruction.

Returns

ValueTask<List<ITrigger>>

Remarks

Enumerates every trigger of the job, in two steps: the listing that names them, then the bulk fetch that materializes them. The returned triggers are snapshots of the stored ones; to modify one you must re-store it (e.g. see RescheduleJob(TriggerKey, ITrigger, CancellationToken)). When the fire times and state a listing needs are enough, use QueryTriggers(TriggerQuery, CancellationToken) with Job and skip the second round trip.

IsJobGroupPaused(IScheduler, string, CancellationToken)

Returns true if the given job group is paused.

public static ValueTask<bool> IsJobGroupPaused(this IScheduler scheduler, string groupName, CancellationToken cancellationToken = default)

Parameters

scheduler IScheduler

The scheduler to query.

groupName string

The group to check.

cancellationToken CancellationToken

The cancellation instruction.

Returns

ValueTask<bool>

Remarks

Asks for the one named group rather than listing every paused one, so the cost does not grow with the number of groups.

IsTriggerGroupPaused(IScheduler, string, CancellationToken)

Returns true if the given trigger group is paused.

public static ValueTask<bool> IsTriggerGroupPaused(this IScheduler scheduler, string groupName, CancellationToken cancellationToken = default)

Parameters

scheduler IScheduler

The scheduler to query.

groupName string

The group to check.

cancellationToken CancellationToken

The cancellation instruction.

Returns

ValueTask<bool>

Remarks

Asks for the one named group rather than listing every paused one, so the cost does not grow with the number of groups.

QueryTriggersInError(IScheduler, CancellationToken)

Lists the first page of triggers that are in Error.

public static ValueTask<PagedResult<TriggerHeader>> QueryTriggersInError(this IScheduler scheduler, CancellationToken cancellationToken = default)

Parameters

scheduler IScheduler

The scheduler to query.

cancellationToken CancellationToken

The cancellation instruction.

Returns

ValueTask<PagedResult<TriggerHeader>>

Remarks

QueryTriggers(TriggerQuery, CancellationToken) with State set. Name the query record instead to count them without reading them — new TriggerQuery { State = TriggerState.Error, Take = 0, IncludeTotalCount = true } — or to narrow the listing to one group.

See Also