Interface ISchedulerListener
- Namespace
- Quartz
- Assembly
- Quartz.dll
The interface to be implemented by classes that want to be informed of major IScheduler events.
public interface ISchedulerListener
Remarks
Every callback is told which scheduler is calling it: a listener reaches the scheduler it serves through its execution context, or as its first argument when there is no execution. No member here is handed an execution context, so every one of them takes the scheduler. One listener instance can therefore serve several schedulers in one host and still say which of them paused a trigger or failed.
Every member has a default implementation, so an implementation only has to write the notifications it cares about. Name defaults to the implementing type's name.
Properties
Name
The name this listener is registered and removed under.
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
JobAdded(IScheduler, IJobDetail, CancellationToken)
Called by the IScheduler when a IJobDetail has been added.
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.
ValueTask JobDeleted(IScheduler scheduler, JobKey jobKey, CancellationToken cancellationToken = default)
Parameters
schedulerISchedulerThe scheduler raising the notification.
jobKeyJobKeyThe job that was deleted.
cancellationTokenCancellationTokenThe cancellation instruction.
Returns
JobInterrupted(IScheduler, JobKey, string, CancellationToken)
Called by the IScheduler when one firing of a IJobDetail has been interrupted.
ValueTask JobInterrupted(IScheduler scheduler, JobKey jobKey, string fireInstanceId, CancellationToken cancellationToken = default)
Parameters
schedulerISchedulerThe scheduler raising the notification.
jobKeyJobKeyThe job whose firing was interrupted.
fireInstanceIdstringThe firing that was interrupted, which is FireInstanceId.
cancellationTokenCancellationTokenThe cancellation instruction.
Returns
Remarks
A job without DisallowConcurrentExecutionAttribute can have several firings in
flight at once, and the key names all of them — so a listener told only the key could not say
which execution was cancelled, could not correlate the interruption with the firing's own
JobToBeExecuted/JobWasExecuted notifications, and could not tell one
Interrupt(jobKey) that cancelled four firings from one that cancelled one.
Interrupt(JobKey, CancellationToken) raises this once per firing it cancelled; InterruptFireInstance(string, CancellationToken) raises it once. The default body calls the key-only overload, so an existing listener keeps working — and gets one call per interrupted firing where it used to get one per call.
JobInterrupted(IScheduler, JobKey, CancellationToken)
Called by the IScheduler when a IJobDetail has been interrupted.
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.
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.
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.
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
JobUnscheduled(IScheduler, TriggerKey, CancellationToken)
Called by the IScheduler when a IJobDetail is unscheduled.
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
JobsPaused(IScheduler, string?, CancellationToken)
Called by the IScheduler when a group of IJobDetails has been paused.
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.
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.
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.
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.
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.
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.
ValueTask SchedulerStarted(IScheduler scheduler, CancellationToken cancellationToken = default)
Parameters
schedulerISchedulerThe scheduler raising the notification.
cancellationTokenCancellationTokenThe cancellation instruction.
Returns
SchedulerStarting(IScheduler, CancellationToken)
Called by the IScheduler to inform the listener that it is starting.
ValueTask SchedulerStarting(IScheduler scheduler, CancellationToken cancellationToken = default)
Parameters
schedulerISchedulerThe scheduler raising the notification.
cancellationTokenCancellationTokenThe cancellation instruction.
Returns
SchedulingDataCleared(IScheduler, CancellationToken)
Called by the IScheduler to inform the listener that all jobs, triggers and calendars were deleted.
ValueTask SchedulingDataCleared(IScheduler scheduler, CancellationToken cancellationToken = default)
Parameters
schedulerISchedulerThe scheduler raising the notification.
cancellationTokenCancellationTokenThe cancellation instruction.
Returns
TriggerFinalized(IScheduler, ITrigger, CancellationToken)
Called by the IScheduler when a ITrigger has reached the condition in which it will never fire again.
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
TriggerInError(IScheduler, TriggerKey, CancellationToken)
Called by the IScheduler when a ITrigger has moved into the Error state and will not fire again until it is reset with ResetTriggerFromErrorState(TriggerKey, CancellationToken).
ValueTask TriggerInError(IScheduler scheduler, TriggerKey triggerKey, CancellationToken cancellationToken = default)
Parameters
schedulerISchedulerThe scheduler raising the notification.
triggerKeyTriggerKeyThe trigger that was parked in the error state.
cancellationTokenCancellationTokenThe cancellation instruction.
Returns
Remarks
This says what changed, not why. Where a cause exists it arrives separately through SchedulerError(IScheduler, SchedulerErrorContext, CancellationToken) — as a JobInstantiationException, for a job that could not be built. Some transitions have no scheduler-side cause at all: the job store also parks a trigger here when it cannot load the job's type or read the job back.
The default implementation does nothing.
TriggerPaused(IScheduler, TriggerKey, CancellationToken)
Called by the IScheduler a ITriggers has been paused.
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.
ValueTask TriggerResumed(IScheduler scheduler, TriggerKey triggerKey, CancellationToken cancellationToken = default)
Parameters
schedulerISchedulerThe scheduler raising the notification.
triggerKeyTriggerKeyThe trigger that was resumed.
cancellationTokenCancellationTokenThe cancellation instruction.
Returns
TriggersInError(IScheduler, JobKey, CancellationToken)
Called by the IScheduler when every ITrigger of a job has moved into the Error state, which is what a failure to instantiate the job leads to.
ValueTask TriggersInError(IScheduler scheduler, JobKey jobKey, CancellationToken cancellationToken = default)
Parameters
schedulerISchedulerThe scheduler raising the notification.
jobKeyJobKeyThe job whose triggers were parked in the error state.
cancellationTokenCancellationTokenThe cancellation instruction.
Returns
Remarks
Keyed by job rather than by trigger because that is the shape of the underlying operation — the persistent store updates the job's triggers in one statement and never enumerates them. Call GetTriggersOfJob(IScheduler, JobKey, CancellationToken) if the individual keys matter.
The default implementation does nothing.
TriggersPaused(IScheduler, string?, CancellationToken)
Called by the IScheduler a group of ITriggers has been paused.
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.
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.