Table of Contents

Class JsonSchedulingDataProcessorPlugin

Namespace
Quartz.Plugins.Json
Assembly
Quartz.Plugins.dll

This plugin loads JSON file(s) to add jobs and schedule them with triggers as the scheduler is initialized, and can optionally periodically scan the file for changes.

public sealed class JsonSchedulingDataProcessorPlugin : ISchedulerPlugin, IFileScanListener
Inheritance
JsonSchedulingDataProcessorPlugin
Implements
Inherited Members

Remarks

This is the JSON analog of XmlSchedulingDataProcessorPlugin, and the maintained one: JSON is where a scheduling file gains what the schedule gains — daily time interval triggers, retry policies and execution groups are readable here and are not in the frozen XML schema. The two plugins have one surface deliberately, so a file format is the only thing that differs between them.

The periodically scanning of files for changes is not currently supported in a clustered environment.

Constructors

JsonSchedulingDataProcessorPlugin()

Creates the plugin with the static logger, a reflecting type loader and the system clock, for a plugin the loader built from a quartz.plugin.<name>.type key and so had nothing to inject into.

public JsonSchedulingDataProcessorPlugin()

JsonSchedulingDataProcessorPlugin(ILogger<JsonSchedulingDataProcessorPlugin>, ITypeLoader, TimeProvider)

Creates the plugin with what a container resolved, which is what UseJsonSchedulingConfiguration uses.

public JsonSchedulingDataProcessorPlugin(ILogger<JsonSchedulingDataProcessorPlugin> logger, ITypeLoader typeLoader, TimeProvider timeProvider)

Parameters

logger ILogger<JsonSchedulingDataProcessorPlugin>

Where the plugin reports what it loaded and what it could not.

typeLoader ITypeLoader

Resolves the job types the file names as strings.

timeProvider TimeProvider

The clock the scanned files' timestamps are compared against.

Methods

FileUpdated(string, CancellationToken)

Informs that certain file has been updated.

public ValueTask FileUpdated(string fileName, CancellationToken cancellationToken = default)

Parameters

fileName string
cancellationToken CancellationToken

Returns

ValueTask

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

pluginName string

The name by which the plugin is identified.

scheduler IScheduler

The scheduler to which the plugin is registered.

cancellationToken CancellationToken

The cancellation instruction.

Returns

ValueTask

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.

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

cancellationToken CancellationToken

Returns

ValueTask

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.