Table of Contents

Interface IListenerManager

Namespace
Quartz
Assembly
Quartz.dll

Client programs may be interested in the 'listener' interfaces that are available from Quartz. The IJobListener interface provides notifications of Job executions. The ITriggerListener interface provides notifications of ITrigger firings. The ISchedulerListener interface provides notifications of scheduler events and errors. Listeners can be associated with local schedulers through the IListenerManager interface.

public interface IListenerManager

Remarks

All three kinds of listener are managed the same way: a listener is identified by its name, registering one under a name that is already taken replaces it, and it is removed by that same name.

The matchers that decide which jobs and triggers a listener hears about are part of that registration, because registration is the moment anyone knows them. A listener that has to hear about something else is registered again under the same name, with the matchers it needs.

Methods

AddJobListener(IJobListener, params IReadOnlyCollection<IMatcher<JobKey>>)

Add the given IJobListener to the IScheduler, and register it to receive events for Jobs that are matched by ANY of the given Matchers.

void AddJobListener(IJobListener jobListener, params IReadOnlyCollection<IMatcher<JobKey>> matchers)

Parameters

jobListener IJobListener
matchers IReadOnlyCollection<IMatcher<JobKey>>

Remarks

If no matchers are provided, the IJobListener will receive all events.

If a IJobListener with the same name is already registered, that listener and the associated matchers will be replaced.

The listener's shape is checked as it is added. Every member of IJobListener has a default implementation, so a public method carrying a notification's name but not its signature still compiles — it just stops implementing anything, and the default runs in its place with nothing to say the method is dead. Such a listener is refused rather than attached and never called.

Exceptions

SchedulerConfigException

jobListener has a public method with an IJobListener member's name but not its signature, so that member is not implemented.

See Also

AddSchedulerListener(ISchedulerListener)

Register the given ISchedulerListener with the IScheduler.

void AddSchedulerListener(ISchedulerListener schedulerListener)

Parameters

schedulerListener ISchedulerListener

Remarks

If a ISchedulerListener with the same Name is already registered, that listener will be replaced.

The listener's shape is checked as it is added. Every member of ISchedulerListener has a default implementation, so a public method carrying a notification's name but not its signature still compiles — it just stops implementing anything, and the default runs in its place with nothing to say the method is dead. Such a listener is refused rather than attached and never called.

Exceptions

SchedulerConfigException

schedulerListener has a public method with an ISchedulerListener member's name but not its signature, so that member is not implemented.

AddTriggerListener(ITriggerListener, params IReadOnlyCollection<IMatcher<TriggerKey>>)

Add the given ITriggerListener to the IScheduler, and register it to receive events for Triggers that are matched by ANY of the given Matchers.

void AddTriggerListener(ITriggerListener triggerListener, params IReadOnlyCollection<IMatcher<TriggerKey>> matchers)

Parameters

triggerListener ITriggerListener
matchers IReadOnlyCollection<IMatcher<TriggerKey>>

Remarks

If no matchers are provided, the ITriggerListener will receive all events.

If a ITriggerListener with the same name is already registered, that listener and the associated matchers will be replaced.

The listener's shape is checked as it is added. Every member of ITriggerListener has a default implementation, so a public method carrying a notification's name but not its signature still compiles — it just stops implementing anything, and the default runs in its place with nothing to say the method is dead. Such a listener is refused rather than attached and never called.

Exceptions

SchedulerConfigException

triggerListener has a public method with an ITriggerListener member's name but not its signature, so that member is not implemented.

See Also

GetJobListener(string)

Get the IJobListener that has the given name.

IJobListener? GetJobListener(string name)

Parameters

name string

The name of the IJobListener to retrieve.

Returns

IJobListener

The IJobListener registered under the name, or null when there is none.

Exceptions

ArgumentNullException

name is null.

GetJobListeners()

Gets all of the IJobListeners in the IScheduler.

IReadOnlyList<IJobListener> GetJobListeners()

Returns

IReadOnlyList<IJobListener>

A shallow copy of all IJobListener instances that are registered.

GetSchedulerListener(string)

Get the ISchedulerListener registered under the given name, or null when there is none.

ISchedulerListener? GetSchedulerListener(string name)

Parameters

name string

Returns

ISchedulerListener

Exceptions

ArgumentNullException

name is null.

GetSchedulerListeners()

Gets all of the ISchedulerListener instances in the IScheduler.

IReadOnlyList<ISchedulerListener> GetSchedulerListeners()

Returns

IReadOnlyList<ISchedulerListener>

A shallow copy of all ISchedulerListener instances that are registered.

GetTriggerListener(string)

Get the ITriggerListener registered under the given name, or null when there is none.

ITriggerListener? GetTriggerListener(string name)

Parameters

name string

Returns

ITriggerListener

GetTriggerListeners()

Gets all of the ITriggerListener instances in the IScheduler.

IReadOnlyList<ITriggerListener> GetTriggerListeners()

Returns

IReadOnlyList<ITriggerListener>

A shallow copy of all ITriggerListener instances that are registered.

RemoveJobListener(string)

Remove the identified IJobListener from the IScheduler.

bool RemoveJobListener(string name)

Parameters

name string

Returns

bool

true if the identified listener was found in the list, and removed; otherwise, false.

Exceptions

ArgumentNullException

name is null.

RemoveSchedulerListener(string)

Remove the identified ISchedulerListener from the IScheduler.

bool RemoveSchedulerListener(string name)

Parameters

name string

The Name of the listener to remove.

Returns

bool

true if the identified listener was found in the list, and removed.

Exceptions

ArgumentNullException

name is null.

RemoveTriggerListener(string)

Removes the identified ITriggerListener from the IScheduler.

bool RemoveTriggerListener(string name)

Parameters

name string

Returns

bool

true if the identified listener was found in the list, and removed.