Class JsonSchedulingDataProcessorPlugin
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
loggerILogger<JsonSchedulingDataProcessorPlugin>Where the plugin reports what it loaded and what it could not.
typeLoaderITypeLoaderResolves the job types the file names as strings.
timeProviderTimeProviderThe 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
fileNamestringcancellationTokenCancellationToken
Returns
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.
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.