Interface IJobListener
- Namespace
- Quartz
- Assembly
- Quartz.dll
The interface to be implemented by classes that want to be informed when a IJobDetail executes. In general, applications that use a IScheduler will not have use for this mechanism.
public interface IJobListener
Remarks
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
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.
ValueTask JobExecutionVetoed(IJobExecutionContext context, CancellationToken cancellationToken = default)
Parameters
contextIJobExecutionContextcancellationTokenCancellationToken
Returns
Remarks
The default implementation does nothing.
- See Also
JobProgressChanged(IJobExecutionContext, FireInstanceProgress, CancellationToken)
Called by the IScheduler when what a running IJob reports through ReportProgress(int, string?) has changed.
ValueTask JobProgressChanged(IJobExecutionContext context, FireInstanceProgress progress, CancellationToken cancellationToken = default)
Parameters
contextIJobExecutionContextThe running firing.
progressFireInstanceProgressWhat the job reported, with its message already cut to MaxMessageLength: the value the job store is handed.
cancellationTokenCancellationTokenThe cancellation instruction.
Returns
Remarks
Raised at the cadence the scheduler writes progress to the job store: the first report at once,
then at most once a second per firing, and only when the value has changed. Reports in between
are coalesced, so progress is the latest. A report the listeners have not
heard by the time the job returns is raised then, before JobWasExecuted(IJobExecutionContext, JobExecutionException?, CancellationToken); every
call for a firing has returned before that one is made.
Never made on the job's own flow, so ReportProgress(int, string?) stays cheap: the call comes from the thread pool, outside the firing's execution context, and one call for a firing is made at a time. Only listeners whose matchers match the job hear it. A listener that throws is logged, and the job, the job store and the other listeners carry on.
In-process only: a listener hears the firings this scheduler runs, not those another node of a cluster runs. QueryFireInstances(FireInstanceQuery, CancellationToken), the HTTP API and the dashboard read progress from anywhere.
The default implementation does nothing.
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.
ValueTask JobToBeExecuted(IJobExecutionContext context, CancellationToken cancellationToken = default)
Parameters
contextIJobExecutionContextcancellationTokenCancellationToken
Returns
Remarks
The default implementation does nothing.
- 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.
ValueTask JobWasExecuted(IJobExecutionContext context, JobExecutionException? jobException, CancellationToken cancellationToken = default)
Parameters
contextIJobExecutionContextjobExceptionJobExecutionExceptioncancellationTokenCancellationToken
Returns
Remarks
The default implementation does nothing.