Class DashboardLiveEventsPlugin
Pushes a scheduler's events to the browsers watching it, which is what makes the dashboard's live view live.
public sealed class DashboardLiveEventsPlugin : ISchedulerPlugin, IJobListener, ITriggerListener, ISchedulerListener
- Inheritance
-
DashboardLiveEventsPlugin
- Implements
- Inherited Members
Remarks
It is all three listener kinds at once because the live view draws all three: a job starting and
finishing, a trigger firing and misfiring, and the scheduler's own lifecycle. Registered by
AddQuartzDashboard against every scheduler in the container rather than named by a
quartz.plugin.*.type key, and told its own scheduler's name when it is initialized — which is
the SignalR group it broadcasts to.
Constructors
DashboardLiveEventsPlugin(IServiceProvider)
Takes the container the dashboard's SignalR hub is resolved from.
public DashboardLiveEventsPlugin(IServiceProvider serviceProvider)
Parameters
serviceProviderIServiceProvider
Remarks
AddQuartzDashboard — so it asks for what it needs the way any other component does. It used
to read the container back out of scheduler.Context["Quartz.ServiceProvider"], which put
Quartz's plumbing into the application's own map, and left the scheduler-context endpoint of the
HTTP API answering 500 for every scheduler a container had built.
The clock is this scheduler's: a named scheduler is built through a provider that resolves its own parts, so a scheduler given a TimeProvider of its own stamps its misfires with it. An execution needs no clock — it carries the fire time the scheduler already recorded.
Properties
Name
The name this listener is registered and removed under.
public string Name { get; }
Property Value
Remarks
Defaults to the implementing type's name, which is the right answer whenever a scheduler has at most one listener of a given type. Override it when several instances of one type are registered with the same scheduler, because the later registration would otherwise replace the earlier one.
Methods
Initialize(string, IScheduler, CancellationToken)
Called during creation of the IScheduler in order to give the ISchedulerPlugin a chance to Initialize.
public ValueTask Initialize(string pluginName, IScheduler scheduler, CancellationToken cancellationToken = default)
Parameters
pluginNamestringThe name by which the plugin is identified.
schedulerISchedulerThe scheduler to which the plugin is registered.
cancellationTokenCancellationTokenThe cancellation instruction.
Returns
Remarks
At this point, the Scheduler's IJobStore is not yet
If you need direct access your plugin, you can have it explicitly put a reference to itself in the IScheduler's SchedulerContext as part of its Initialize(string, IScheduler, CancellationToken) method.
JobAdded(IScheduler, IJobDetail, CancellationToken)
Called by the IScheduler when a IJobDetail has been added.
public ValueTask JobAdded(IScheduler scheduler, IJobDetail jobDetail, CancellationToken cancellationToken = default)
Parameters
schedulerISchedulerThe scheduler raising the notification.
jobDetailIJobDetailThe job that was added.
cancellationTokenCancellationTokenThe cancellation instruction.
Returns
JobDeleted(IScheduler, JobKey, CancellationToken)
Called by the IScheduler when a IJobDetail has been deleted.
public ValueTask JobDeleted(IScheduler scheduler, JobKey jobKey, CancellationToken cancellationToken = default)
Parameters
schedulerISchedulerThe scheduler raising the notification.
jobKeyJobKeyThe job that was deleted.
cancellationTokenCancellationTokenThe cancellation instruction.
Returns
JobExecutionVetoed(IJobExecutionContext, CancellationToken)
Called by the IScheduler when a IJobDetail was about to be executed (an associated ITrigger has occurred), but a ITriggerListener vetoed it's execution.
public ValueTask JobExecutionVetoed(IJobExecutionContext context, CancellationToken cancellationToken = default)
Parameters
contextIJobExecutionContextcancellationTokenCancellationToken
Returns
Remarks
The default implementation does nothing.
- See Also
JobInterrupted(IScheduler, JobKey, CancellationToken)
Called by the IScheduler when a IJobDetail has been interrupted.
public ValueTask JobInterrupted(IScheduler scheduler, JobKey jobKey, CancellationToken cancellationToken = default)
Parameters
schedulerISchedulerThe scheduler raising the notification.
jobKeyJobKeyThe job that was interrupted.
cancellationTokenCancellationTokenThe cancellation instruction.
Returns
Remarks
The scheduler raises the JobInterrupted(IScheduler, JobKey, string, CancellationToken) overload, which says which firing was interrupted; this one is what that overload's default body calls, so a listener written before the fire instance id existed keeps hearing about every interruption. Implement one or the other, not both.
JobPaused(IScheduler, JobKey, CancellationToken)
Called by the IScheduler when a IJobDetail has been paused.
public ValueTask JobPaused(IScheduler scheduler, JobKey jobKey, CancellationToken cancellationToken = default)
Parameters
schedulerISchedulerThe scheduler raising the notification.
jobKeyJobKeyThe job that was paused.
cancellationTokenCancellationTokenThe cancellation instruction.
Returns
JobResumed(IScheduler, JobKey, CancellationToken)
Called by the IScheduler when a IJobDetail has been un-paused.
public ValueTask JobResumed(IScheduler scheduler, JobKey jobKey, CancellationToken cancellationToken = default)
Parameters
schedulerISchedulerThe scheduler raising the notification.
jobKeyJobKeyThe job that was resumed.
cancellationTokenCancellationTokenThe cancellation instruction.
Returns
JobScheduled(IScheduler, ITrigger, CancellationToken)
Called by the IScheduler when a IJobDetail is scheduled.
public ValueTask JobScheduled(IScheduler scheduler, ITrigger trigger, CancellationToken cancellationToken = default)
Parameters
schedulerISchedulerThe scheduler raising the notification.
triggerITriggerThe trigger the job was scheduled with.
cancellationTokenCancellationTokenThe cancellation instruction.
Returns
JobToBeExecuted(IJobExecutionContext, CancellationToken)
Called by the IScheduler when a IJobDetail is about to be executed (an associated ITrigger has occurred).
This method will not be invoked if the execution of the Job was vetoed by a ITriggerListener.
public ValueTask JobToBeExecuted(IJobExecutionContext context, CancellationToken cancellationToken = default)
Parameters
contextIJobExecutionContextcancellationTokenCancellationToken
Returns
Remarks
The default implementation does nothing.
- See Also
JobUnscheduled(IScheduler, TriggerKey, CancellationToken)
Called by the IScheduler when a IJobDetail is unscheduled.
public ValueTask JobUnscheduled(IScheduler scheduler, TriggerKey triggerKey, CancellationToken cancellationToken = default)
Parameters
schedulerISchedulerThe scheduler raising the notification.
triggerKeyTriggerKeyThe trigger that was removed.
cancellationTokenCancellationTokenThe cancellation instruction.
Returns
- See Also
JobWasExecuted(IJobExecutionContext, JobExecutionException?, CancellationToken)
Called by the IScheduler after a IJobDetail has been executed, and be for the associated IOperableTrigger's Triggered(ICalendar?) method has been called.
public ValueTask JobWasExecuted(IJobExecutionContext context, JobExecutionException? jobException, CancellationToken cancellationToken = default)
Parameters
contextIJobExecutionContextjobExceptionJobExecutionExceptioncancellationTokenCancellationToken
Returns
Remarks
The default implementation does nothing.
JobsPaused(IScheduler, string?, CancellationToken)
Called by the IScheduler when a group of IJobDetails has been paused.
public ValueTask JobsPaused(IScheduler scheduler, string? jobGroup, CancellationToken cancellationToken = default)
Parameters
schedulerISchedulerThe scheduler raising the notification.
jobGroupstringThe job group, or null for all groups.
cancellationTokenCancellationTokenThe cancellation instruction.
Returns
Remarks
A null jobGroup means every group, matching
TriggersPaused(IScheduler, string?, CancellationToken). The scheduler's own pause-all path raises this once per
group rather than once with no group, but a job store or a caller raising the event itself
may report all groups that way.
JobsResumed(IScheduler, string?, CancellationToken)
Called by the IScheduler when a group of IJobDetails has been un-paused.
public ValueTask JobsResumed(IScheduler scheduler, string? jobGroup, CancellationToken cancellationToken = default)
Parameters
schedulerISchedulerThe scheduler raising the notification.
jobGroupstringThe job group, or null for all groups.
cancellationTokenCancellationTokenThe cancellation instruction.
Returns
Remarks
A null jobGroup means every group, matching
TriggersResumed(IScheduler, string?, CancellationToken).
SchedulerError(IScheduler, SchedulerErrorContext, CancellationToken)
Called by the IScheduler when a serious error has occurred within the scheduler - such as repeated failures in the IJobStore, or the inability to instantiate a IJob instance when its ITrigger has fired.
public ValueTask SchedulerError(IScheduler scheduler, SchedulerErrorContext errorContext, CancellationToken cancellationToken = default)
Parameters
schedulerISchedulerThe scheduler raising the notification.
errorContextSchedulerErrorContextWhat went wrong, and what it went wrong for.
cancellationTokenCancellationTokenThe cancellation instruction.
Returns
Remarks
SchedulerErrorContext carries the trigger, job and firing the error was raised for wherever the scheduler knew them, so a listener can pause the offending trigger rather than read the keys out of the message text.
SchedulerInStandbyMode(IScheduler, CancellationToken)
Called by the IScheduler to inform the listener that it has move to standby mode.
public ValueTask SchedulerInStandbyMode(IScheduler scheduler, CancellationToken cancellationToken = default)
Parameters
schedulerISchedulerThe scheduler raising the notification.
cancellationTokenCancellationTokenThe cancellation instruction.
Returns
SchedulerShutdown(IScheduler, CancellationToken)
Called by the IScheduler to inform the listener that it has Shutdown.
public ValueTask SchedulerShutdown(IScheduler scheduler, CancellationToken cancellationToken = default)
Parameters
schedulerISchedulerThe scheduler raising the notification.
cancellationTokenCancellationTokenThe cancellation instruction.
Returns
SchedulerShuttingDown(IScheduler, CancellationToken)
Called by the IScheduler to inform the listener that it has begun the shutdown sequence.
public ValueTask SchedulerShuttingDown(IScheduler scheduler, CancellationToken cancellationToken = default)
Parameters
schedulerISchedulerThe scheduler raising the notification.
cancellationTokenCancellationTokenThe cancellation instruction.
Returns
SchedulerStarted(IScheduler, CancellationToken)
Called by the IScheduler to inform the listener that it has started.
public ValueTask SchedulerStarted(IScheduler scheduler, CancellationToken cancellationToken = default)
Parameters
schedulerISchedulerThe scheduler raising the notification.
cancellationTokenCancellationTokenThe cancellation instruction.
Returns
SchedulerStarting(IScheduler, CancellationToken)
Nothing is pushed: a scheduler that is starting is an event, not a state it is in.
public ValueTask SchedulerStarting(IScheduler scheduler, CancellationToken cancellationToken = default)
Parameters
schedulerISchedulercancellationTokenCancellationToken
Returns
Remarks
The state it will be in arrives a moment later as SchedulerStarted(IScheduler, CancellationToken), and pushing "starting" first only gave a browser a value that is not a SchedulerStatus to render in the meantime.
SchedulingDataCleared(IScheduler, CancellationToken)
Called by the IScheduler to inform the listener that all jobs, triggers and calendars were deleted.
public ValueTask SchedulingDataCleared(IScheduler scheduler, CancellationToken cancellationToken = default)
Parameters
schedulerISchedulerThe scheduler raising the notification.
cancellationTokenCancellationTokenThe cancellation instruction.
Returns
Shutdown(CancellationToken)
Called in order to inform the ISchedulerPlugin that it should free up all of it's resources because the scheduler is shutting down.
public ValueTask Shutdown(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationToken
Returns
Remarks
Does nothing unless the plugin says otherwise. Most plugins do all their work in Initialize(string, IScheduler, CancellationToken) — attaching a listener, registering a resolver — and have nothing to say at the two lifecycle moments; implement this only when there is something that cannot happen until the scheduler is running.
Start(CancellationToken)
Called when the associated IScheduler is started, in order to let the plug-in know it can now make calls into the scheduler if it needs to.
public ValueTask Start(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationToken
Returns
Remarks
Does nothing unless the plugin says otherwise. Most plugins do all their work in Initialize(string, IScheduler, CancellationToken) — attaching a listener, registering a resolver — and have nothing to say at the two lifecycle moments; implement this only when there is something that cannot happen until the scheduler is running.
TriggerComplete(ITrigger, IJobExecutionContext, SchedulerInstruction, CancellationToken)
Called by the IScheduler when a ITrigger has fired, it's associated IJobDetail has been executed, and it's Triggered(ICalendar?) method has been called.
public ValueTask TriggerComplete(ITrigger trigger, IJobExecutionContext context, SchedulerInstruction triggerInstructionCode, CancellationToken cancellationToken = default)
Parameters
triggerITriggerThe ITrigger that was fired.
contextIJobExecutionContextThe IJobExecutionContext that was passed to the IJob'sExecute(IJobExecutionContext, CancellationToken) method.
triggerInstructionCodeSchedulerInstructionThe result of the call on the ITrigger'sTriggered(ICalendar?) method.
cancellationTokenCancellationTokenThe cancellation instruction.
Returns
Remarks
The default implementation does nothing.
TriggerFinalized(IScheduler, ITrigger, CancellationToken)
Called by the IScheduler when a ITrigger has reached the condition in which it will never fire again.
public ValueTask TriggerFinalized(IScheduler scheduler, ITrigger trigger, CancellationToken cancellationToken = default)
Parameters
schedulerISchedulerThe scheduler raising the notification.
triggerITriggerThe trigger that will never fire again.
cancellationTokenCancellationTokenThe cancellation instruction.
Returns
TriggerFired(ITrigger, IJobExecutionContext, CancellationToken)
Called by the IScheduler when a ITrigger has fired, and it's associated IJobDetail is about to be executed.
It is called before the VetoJobExecution(ITrigger, IJobExecutionContext, CancellationToken) method of this interface.
public ValueTask TriggerFired(ITrigger trigger, IJobExecutionContext context, CancellationToken cancellationToken = default)
Parameters
triggerITriggerThe ITrigger that has fired.
contextIJobExecutionContextThe IJobExecutionContext that will be passed to the IJob'sExecute(IJobExecutionContext, CancellationToken) method.
cancellationTokenCancellationTokenThe cancellation instruction.
Returns
Remarks
The default implementation does nothing.
TriggerMisfired(ITrigger, IScheduler, CancellationToken)
Called by the IScheduler when a ITrigger has misfired.
Consideration should be given to how much time is spent in this method, as it will affect all triggers that are misfiring. If you have lots of triggers misfiring at once, it could be an issue it this method does a lot.
public ValueTask TriggerMisfired(ITrigger trigger, IScheduler scheduler, CancellationToken cancellationToken = default)
Parameters
triggerITriggerThe ITrigger that has misfired.
schedulerISchedulerThe scheduler raising the notification.
cancellationTokenCancellationTokenThe cancellation instruction.
Returns
Remarks
The scheduler is passed because a misfire is noticed outside any execution, so there is no IJobExecutionContext here to reach it through. It comes after the trigger, as the context does on every other notification in this interface.
The default implementation does nothing.
TriggerPaused(IScheduler, TriggerKey, CancellationToken)
Called by the IScheduler a ITriggers has been paused.
public ValueTask TriggerPaused(IScheduler scheduler, TriggerKey triggerKey, CancellationToken cancellationToken = default)
Parameters
schedulerISchedulerThe scheduler raising the notification.
triggerKeyTriggerKeyThe trigger that was paused.
cancellationTokenCancellationTokenThe cancellation instruction.
Returns
TriggerResumed(IScheduler, TriggerKey, CancellationToken)
Called by the IScheduler when a ITrigger has been un-paused.
public ValueTask TriggerResumed(IScheduler scheduler, TriggerKey triggerKey, CancellationToken cancellationToken = default)
Parameters
schedulerISchedulerThe scheduler raising the notification.
triggerKeyTriggerKeyThe trigger that was resumed.
cancellationTokenCancellationTokenThe cancellation instruction.
Returns
TriggersPaused(IScheduler, string?, CancellationToken)
Called by the IScheduler a group of ITriggers has been paused.
public ValueTask TriggersPaused(IScheduler scheduler, string? triggerGroup, CancellationToken cancellationToken = default)
Parameters
schedulerISchedulerThe scheduler raising the notification.
triggerGroupstringThe trigger group, or null for all groups.
cancellationTokenCancellationTokenThe cancellation instruction.
Returns
Remarks
A null triggerGroup means every group.
TriggersResumed(IScheduler, string?, CancellationToken)
Called by the IScheduler when a group of ITriggers has been un-paused.
public ValueTask TriggersResumed(IScheduler scheduler, string? triggerGroup, CancellationToken cancellationToken = default)
Parameters
schedulerISchedulerThe scheduler raising the notification.
triggerGroupstringThe trigger group, or null for all groups.
cancellationTokenCancellationTokenThe cancellation instruction.
Returns
Remarks
A null triggerGroup means every group.
VetoJobExecution(ITrigger, IJobExecutionContext, CancellationToken)
Called by the IScheduler when a ITrigger has fired, and it's associated IJobDetail is about to be executed.
It is called after the TriggerFired(ITrigger, IJobExecutionContext, CancellationToken) method of this interface. If the implementation vetoes the execution (via returning true), the job's execute method will not be called.
public ValueTask<bool> VetoJobExecution(ITrigger trigger, IJobExecutionContext context, CancellationToken cancellationToken = default)
Parameters
triggerITriggerThe ITrigger that has fired.
contextIJobExecutionContextThe IJobExecutionContext that will be passed to the IJob'sExecute(IJobExecutionContext, CancellationToken) method.
cancellationTokenCancellationTokenThe cancellation instruction.
Returns
Remarks
The default implementation vetoes nothing.