Table of Contents

Interface IQuartzApiClient

Namespace
Quartz.Dashboard.Services
Assembly
Quartz.Dashboard.dll

The data source behind the dashboard's pages: either the schedulers in this process or a Quartz HTTP API somewhere else.

public interface IQuartzApiClient

Remarks

This is the dashboard's own projection of the HTTP API, not the wire contract itself — it is shaped for the pages that read it, and it is public so that an application can replace it. It speaks Quartz's vocabulary throughout: TriggerState and SchedulerStatus rather than strings, JobKeyDto and TriggerKeyDto rather than loose group/name pairs, PagedQuery's Skip/Take with PagedResult<T> rather than a paging model of its own, and ITrigger, ICalendar and JobDataMap rather than JSON.

The verbs are IScheduler's own, spelled the same way: an operation this interface forwards carries the name the scheduler gives it — Start(string, CancellationToken), Interrupt(string, JobKeyDto, CancellationToken), one TriggerJob(string, JobKeyDto, JobDataMap?, CancellationToken) with an optional map, and the Query* family for the paged listings. Only what has no counterpart on IScheduler — the scheduler listing, the execution history — names itself.

A mutation that can find nothing to act on answers with the scheduler's own bool: whether it applied. Every such member reports it, because a name shared with IScheduler that dropped the answer would read as the same operation and quietly not be one — and a page cannot tell "deleted" from "was already gone" without it.

A trigger and a calendar arrive as themselves because Quartz already owns the polymorphism they need: the serializer registry maps each kind to its own serializer, custom kinds an application registered included, and the wire format is that discriminated shape. A DTO family of the dashboard's own would have to be extended for every trigger kind and would still not describe a kind it had never heard of.

Missing things. Every member that takes a schedulerName raises KeyNotFoundException when no scheduler goes by that name, and the four members that return the thing itself rather than a listing — GetScheduler(string, CancellationToken), GetJobDetail(string, JobKeyDto, CancellationToken), GetTrigger(string, TriggerKeyDto, CancellationToken) and GetCalendar(string, string, CancellationToken) — raise it again when the thing is gone. Their return types are non-nullable, so there is no other answer available to them, and the dashboard's error boundary renders that exception as the "not found" page. A replacement that answered null! instead would fault the page with a NullReferenceException somewhere further in.

Things this data source cannot report. A capability the source does not have is a value, not an exception: GetExecutionLimits(string, CancellationToken) answers CannotReport where the underlying scheduler refuses with NotSupportedException, because "this source cannot say" and "nothing is limited" are different facts and the overview draws them differently.

Additivity. This interface is frozen from 4.0.0-beta.1 in the sense the release promises: a member added to it in 4.x arrives as a default interface member, so an implementation of an application's own keeps compiling. Its default body reports the datum as unavailable the way CannotReport does, rather than inventing one.

Methods

AddCalendar(string, AddCalendarRequest, CancellationToken)

Stores a calendar under a name, which triggers refer to in order to exclude times from firing.

ValueTask AddCalendar(string schedulerName, AddCalendarRequest request, CancellationToken cancellationToken = default)

Parameters

schedulerName string
request AddCalendarRequest
cancellationToken CancellationToken

Returns

ValueTask

AddJob(string, AddJobRequest, CancellationToken)

Stores a job with no trigger, for one that is triggered by hand or scheduled later.

ValueTask AddJob(string schedulerName, AddJobRequest request, CancellationToken cancellationToken = default)

Parameters

schedulerName string
request AddJobRequest
cancellationToken CancellationToken

Returns

ValueTask

CountMisfires(string, DateTimeOffset, CancellationToken)

Counts the misfires the scheduler has recorded since since.

ValueTask<int> CountMisfires(string schedulerName, DateTimeOffset since, CancellationToken cancellationToken = default)

Parameters

schedulerName string
since DateTimeOffset
cancellationToken CancellationToken

Returns

ValueTask<int>

Remarks

A count rather than a page, because the overview's tile asks "how bad is it right now" and a store keeping its history in a database can answer that without loading rows it would discard.

DeleteCalendar(string, string, CancellationToken)

Deletes the calendar. Returns true when it existed and was deleted, false when there was nothing to delete.

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

Parameters

schedulerName string
calendarName string
cancellationToken CancellationToken

Returns

ValueTask<bool>

DeleteJob(string, JobKeyDto, CancellationToken)

Deletes the job and every trigger that fires it. Returns true when the job existed and was deleted, false when there was nothing to delete.

ValueTask<bool> DeleteJob(string schedulerName, JobKeyDto jobKey, CancellationToken cancellationToken = default)

Parameters

schedulerName string
jobKey JobKeyDto
cancellationToken CancellationToken

Returns

ValueTask<bool>

GetCalendar(string, string, CancellationToken)

Returns the calendar itself, of whichever kind it is.

ValueTask<ICalendar> GetCalendar(string schedulerName, string calendarName, CancellationToken cancellationToken = default)

Parameters

schedulerName string
calendarName string
cancellationToken CancellationToken

Returns

ValueTask<ICalendar>

Exceptions

KeyNotFoundException

No scheduler goes by schedulerName, or it holds no calendar named calendarName.

GetCalendarNames(string, CancellationToken)

Returns the names of every calendar the scheduler holds — a short list rather than a page.

ValueTask<List<string>> GetCalendarNames(string schedulerName, CancellationToken cancellationToken = default)

Parameters

schedulerName string
cancellationToken CancellationToken

Returns

ValueTask<List<string>>

GetExecutionLimits(string, CancellationToken)

Returns the execution limits the scheduler is running with, or CannotReport when this data source cannot say.

ValueTask<ExecutionLimitsDto> GetExecutionLimits(string schedulerName, CancellationToken cancellationToken = default)

Parameters

schedulerName string
cancellationToken CancellationToken

Returns

ValueTask<ExecutionLimitsDto>

Remarks

Never null: a scheduler with nothing limited answers with an empty Limits, which is a different fact from a scheduler that cannot report limits at all, and the overview says which of the two it is looking at.

GetJobDetail(string, JobKeyDto, CancellationToken)

Returns the job's definition — its type, its durability and its data map.

ValueTask<JobDetailDto> GetJobDetail(string schedulerName, JobKeyDto jobKey, CancellationToken cancellationToken = default)

Parameters

schedulerName string
jobKey JobKeyDto
cancellationToken CancellationToken

Returns

ValueTask<JobDetailDto>

Exceptions

KeyNotFoundException

No scheduler goes by schedulerName, or it holds no job under jobKey.

GetScheduler(string, CancellationToken)

Returns one scheduler with the metadata it was built with. Only a scheduler that exists can answer; a registration nothing has built is reported by GetSchedulers(CancellationToken) and has no detail to read.

ValueTask<SchedulerDetailDto> GetScheduler(string schedulerName, CancellationToken cancellationToken = default)

Parameters

schedulerName string
cancellationToken CancellationToken

Returns

ValueTask<SchedulerDetailDto>

Exceptions

KeyNotFoundException

No scheduler goes by schedulerName.

GetSchedulers(CancellationToken)

Returns every scheduler the container knows about, ordered by name — the registrations included, so a scheduler nothing has built yet is listed with a null Status rather than being invisible.

ValueTask<List<SchedulerHeaderDto>> GetSchedulers(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

ValueTask<List<SchedulerHeaderDto>>

Remarks

Nothing is created by asking. That is why the listing is the registrations rather than the repository: an operator enumerating tenants must not start every one of them.

GetTrigger(string, TriggerKeyDto, CancellationToken)

Returns the trigger itself — a ICronTrigger, ISimpleTrigger or whichever kind it is, including one an application registered its own serializer for.

ValueTask<ITrigger> GetTrigger(string schedulerName, TriggerKeyDto triggerKey, CancellationToken cancellationToken = default)

Parameters

schedulerName string
triggerKey TriggerKeyDto
cancellationToken CancellationToken

Returns

ValueTask<ITrigger>

Exceptions

KeyNotFoundException

No scheduler goes by schedulerName, or it holds no trigger under triggerKey.

GetTriggerState(string, TriggerKeyDto, CancellationToken)

Returns the trigger's state, which is None when there is no such trigger — the one read here that answers rather than raising.

ValueTask<TriggerState> GetTriggerState(string schedulerName, TriggerKeyDto triggerKey, CancellationToken cancellationToken = default)

Parameters

schedulerName string
triggerKey TriggerKeyDto
cancellationToken CancellationToken

Returns

ValueTask<TriggerState>

GetTriggersOfJob(string, JobKeyDto, CancellationToken)

Returns every trigger scheduled against the job, which is a short list rather than a page: a job has as many triggers as somebody wrote for it.

ValueTask<List<TriggerHeaderDto>> GetTriggersOfJob(string schedulerName, JobKeyDto jobKey, CancellationToken cancellationToken = default)

Parameters

schedulerName string
jobKey JobKeyDto
cancellationToken CancellationToken

Returns

ValueTask<List<TriggerHeaderDto>>

Interrupt(string, JobKeyDto, CancellationToken)

Interrupts every execution of the job on this node. Returns true when at least one execution was asked to stop, false when the job was not running here.

ValueTask<bool> Interrupt(string schedulerName, JobKeyDto jobKey, CancellationToken cancellationToken = default)

Parameters

schedulerName string
jobKey JobKeyDto
cancellationToken CancellationToken

Returns

ValueTask<bool>

Remarks

A job that does not watch its cancellation token runs to completion regardless, so the flag says the interrupt was delivered rather than that the work stopped.

InterruptFireInstance(string, string, CancellationToken)

Interrupts one execution, named by its fire instance id. Returns true when that execution was found and asked to stop, false when it had already finished or belongs to another node.

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

Parameters

schedulerName string
fireInstanceId string
cancellationToken CancellationToken

Returns

ValueTask<bool>

Remarks

The single-execution form of Interrupt(string, JobKeyDto, CancellationToken), which interrupts every execution of the job. Node-local on the server side: a firing owned by another node is interrupted by asking that node.

PauseAll(string, CancellationToken)

Pauses every trigger group, so nothing fires until ResumeAll(string, CancellationToken).

ValueTask PauseAll(string schedulerName, CancellationToken cancellationToken = default)

Parameters

schedulerName string
cancellationToken CancellationToken

Returns

ValueTask

PauseJob(string, JobKeyDto, CancellationToken)

Pauses the job. Returns true when the job existed and was paused, false when there was nothing to pause.

ValueTask<bool> PauseJob(string schedulerName, JobKeyDto jobKey, CancellationToken cancellationToken = default)

Parameters

schedulerName string
jobKey JobKeyDto
cancellationToken CancellationToken

Returns

ValueTask<bool>

PauseTrigger(string, TriggerKeyDto, CancellationToken)

Pauses the trigger. Returns true when the trigger existed and was moved into the paused state, false when there was nothing to pause.

ValueTask<bool> PauseTrigger(string schedulerName, TriggerKeyDto triggerKey, CancellationToken cancellationToken = default)

Parameters

schedulerName string
triggerKey TriggerKeyDto
cancellationToken CancellationToken

Returns

ValueTask<bool>

QueryClusterNodes(string, CancellationToken)

Returns the scheduler's cluster nodes, the node that answered first. A scheduler that is not clustered answers with the one node it is, with no check-in times.

ValueTask<List<ClusterNodeDto>> QueryClusterNodes(string schedulerName, CancellationToken cancellationToken = default)

Parameters

schedulerName string
cancellationToken CancellationToken

Returns

ValueTask<List<ClusterNodeDto>>

Remarks

Joins to QueryFireInstances(string, DashboardFireInstanceQuery, CancellationToken) on SchedulerInstanceId, which is how the Cluster page counts what each node is running.

QueryExecutions(DashboardHistoryQuery, CancellationToken)

Returns one page of execution history, newest first.

ValueTask<PagedResult<DashboardHistoryEntry>> QueryExecutions(DashboardHistoryQuery query, CancellationToken cancellationToken = default)

Parameters

query DashboardHistoryQuery
cancellationToken CancellationToken

Returns

ValueTask<PagedResult<DashboardHistoryEntry>>

Remarks

The history is IDashboardHistoryStore's, and that store always answers: a store holding nothing returns an empty page, which is what "no executions recorded" is. This used to be nullable because the deleted remote client turned a 404 into "no history at all", and nothing in this process has ever had that answer to give.

QueryFireInstances(string, DashboardFireInstanceQuery, CancellationToken)

Returns one page of firings — by default the ones that are running — ordered by trigger group, then trigger name, then fire instance id. With a persistent job store this covers the whole cluster, so a firing owned by another node is listed too, marked with that node's SchedulerInstanceId.

ValueTask<PagedResult<FireInstanceDto>> QueryFireInstances(string schedulerName, DashboardFireInstanceQuery query, CancellationToken cancellationToken = default)

Parameters

schedulerName string
query DashboardFireInstanceQuery
cancellationToken CancellationToken

Returns

ValueTask<PagedResult<FireInstanceDto>>

QueryJobGroups(string, DashboardGroupQuery, CancellationToken)

Returns one page of job groups, ordered by name, each carrying whether it is paused.

ValueTask<PagedResult<JobGroupDto>> QueryJobGroups(string schedulerName, DashboardGroupQuery query, CancellationToken cancellationToken = default)

Parameters

schedulerName string
query DashboardGroupQuery
cancellationToken CancellationToken

Returns

ValueTask<PagedResult<JobGroupDto>>

QueryJobs(string, DashboardJobQuery, CancellationToken)

Returns one page of jobs, ordered by group and then name. The page always reports HasMore and, because the dashboard asks for it, a TotalCount.

ValueTask<PagedResult<JobKeyDto>> QueryJobs(string schedulerName, DashboardJobQuery query, CancellationToken cancellationToken = default)

Parameters

schedulerName string
query DashboardJobQuery
cancellationToken CancellationToken

Returns

ValueTask<PagedResult<JobKeyDto>>

QueryMisfires(DashboardMisfireQuery, CancellationToken)

Returns one page of the triggers that missed a firing, newest first.

ValueTask<PagedResult<DashboardMisfireEntry>> QueryMisfires(DashboardMisfireQuery query, CancellationToken cancellationToken = default)

Parameters

query DashboardMisfireQuery
cancellationToken CancellationToken

Returns

ValueTask<PagedResult<DashboardMisfireEntry>>

Remarks

The history is IDashboardHistoryStore's, and that store always answers: a store holding nothing returns an empty page, which is what "no executions recorded" is. This used to be nullable because the deleted remote client turned a 404 into "no history at all", and nothing in this process has ever had that answer to give.

QueryTriggerGroups(string, DashboardGroupQuery, CancellationToken)

Returns one page of trigger groups, ordered by name, each carrying whether it is paused.

ValueTask<PagedResult<TriggerGroupDto>> QueryTriggerGroups(string schedulerName, DashboardGroupQuery query, CancellationToken cancellationToken = default)

Parameters

schedulerName string
query DashboardGroupQuery
cancellationToken CancellationToken

Returns

ValueTask<PagedResult<TriggerGroupDto>>

QueryTriggers(string, DashboardTriggerQuery, CancellationToken)

Returns one page of triggers, ordered by group and then name, each carrying its state and execution group.

ValueTask<PagedResult<TriggerHeaderDto>> QueryTriggers(string schedulerName, DashboardTriggerQuery query, CancellationToken cancellationToken = default)

Parameters

schedulerName string
query DashboardTriggerQuery
cancellationToken CancellationToken

Returns

ValueTask<PagedResult<TriggerHeaderDto>>

RescheduleJob(string, TriggerKeyDto, RescheduleRequest, CancellationToken)

Replaces the trigger with the one in the request, keeping the job it fires.

ValueTask RescheduleJob(string schedulerName, TriggerKeyDto triggerKey, RescheduleRequest request, CancellationToken cancellationToken = default)

Parameters

schedulerName string
triggerKey TriggerKeyDto
request RescheduleRequest
cancellationToken CancellationToken

Returns

ValueTask

ResetTriggerFromErrorState(string, TriggerKeyDto, CancellationToken)

Resets the trigger from the error state. Returns true when the trigger existed in the error state and was reset, false otherwise.

ValueTask<bool> ResetTriggerFromErrorState(string schedulerName, TriggerKeyDto triggerKey, CancellationToken cancellationToken = default)

Parameters

schedulerName string
triggerKey TriggerKeyDto
cancellationToken CancellationToken

Returns

ValueTask<bool>

ResumeAll(string, CancellationToken)

Resumes every trigger group, applying each trigger's misfire instruction to what it missed.

ValueTask ResumeAll(string schedulerName, CancellationToken cancellationToken = default)

Parameters

schedulerName string
cancellationToken CancellationToken

Returns

ValueTask

ResumeJob(string, JobKeyDto, CancellationToken)

Resumes the job. Returns true when the job existed and was resumed, false when there was nothing to resume.

ValueTask<bool> ResumeJob(string schedulerName, JobKeyDto jobKey, CancellationToken cancellationToken = default)

Parameters

schedulerName string
jobKey JobKeyDto
cancellationToken CancellationToken

Returns

ValueTask<bool>

ResumeTrigger(string, TriggerKeyDto, CancellationToken)

Resumes the trigger. Returns true when the trigger existed in a paused state and was resumed, false when there was nothing to resume.

ValueTask<bool> ResumeTrigger(string schedulerName, TriggerKeyDto triggerKey, CancellationToken cancellationToken = default)

Parameters

schedulerName string
triggerKey TriggerKeyDto
cancellationToken CancellationToken

Returns

ValueTask<bool>

ScheduleJob(string, ScheduleJobRequest, CancellationToken)

Schedules a trigger, together with the job it fires when the request carries one.

ValueTask ScheduleJob(string schedulerName, ScheduleJobRequest request, CancellationToken cancellationToken = default)

Parameters

schedulerName string
request ScheduleJobRequest
cancellationToken CancellationToken

Returns

ValueTask

Shutdown(string, CancellationToken)

Shuts the scheduler down, waiting for the jobs in flight. A scheduler that has shut down cannot be started again.

ValueTask Shutdown(string schedulerName, CancellationToken cancellationToken = default)

Parameters

schedulerName string
cancellationToken CancellationToken

Returns

ValueTask

Standby(string, CancellationToken)

Puts the scheduler in standby: it keeps its state and stops firing until it is started again.

ValueTask Standby(string schedulerName, CancellationToken cancellationToken = default)

Parameters

schedulerName string
cancellationToken CancellationToken

Returns

ValueTask

Start(string, CancellationToken)

Starts the scheduler, so its triggers begin firing.

ValueTask Start(string schedulerName, CancellationToken cancellationToken = default)

Parameters

schedulerName string
cancellationToken CancellationToken

Returns

ValueTask

TriggerJob(string, JobKeyDto, JobDataMap?, CancellationToken)

Triggers the job once, with jobDataMap merged over the job's own data for that one firing when a map is given.

ValueTask TriggerJob(string schedulerName, JobKeyDto jobKey, JobDataMap? jobDataMap = null, CancellationToken cancellationToken = default)

Parameters

schedulerName string
jobKey JobKeyDto
jobDataMap JobDataMap
cancellationToken CancellationToken

Returns

ValueTask

Remarks

One method with an optional map, exactly as TriggerJob(JobKey, JobDataMap?, CancellationToken) is: firing a job with data and firing it without are the same operation, and the pair of methods this replaces made them look like two.

UnscheduleJob(string, TriggerKeyDto, CancellationToken)

Removes the trigger, and the job it fired if that job is not durable and has no triggers left. Returns true when the trigger existed and was removed, false when there was nothing to remove.

ValueTask<bool> UnscheduleJob(string schedulerName, TriggerKeyDto triggerKey, CancellationToken cancellationToken = default)

Parameters

schedulerName string
triggerKey TriggerKeyDto
cancellationToken CancellationToken

Returns

ValueTask<bool>