Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Managing configuration for Quartz.Net

Quartz.Net uses XML files to configure the jobs that are to be run and the schedules for running those jobs. As far as I understand, the only other option to XML configuration is to configure the jobs and schedules at compile time.

We have a large number of scheduled tasks (250 tasks that are each deployed into between 3 to 5 environments) and are looking to migrate these to use Quartz.Net.

[1] Are there any best practices to managing the job and schedule configuration information in Quarts.Net?

[2] Is there any tooling for the creation of the configuration files?

An example configuration for a job is:

<job>
  <name>addDirectoryScanListener</name>
  <group>directoryScanJobExample</group>
  <description>Sample job for Quartz Server</description>
  <job-type>Examples.DirectoryScanListenerExample, Examples</job-type>
</job>

<trigger>
  <simple>
    <name>addDirectoryScanListenerSimpleTrigger</name>
    <group>directoryScanJobExampleSimpleTriggerGroup</group>
    <description>Simple trigger to simply fire sample job</description>
    <job-name>addDirectoryScanListener</job-name>
    <job-group>directoryScanJobExample</job-group>
    <misfire-instruction>SmartPolicy</misfire-instruction>
    <repeat-count>0</repeat-count>
    <repeat-interval>10000</repeat-interval>
  </simple>
</trigger>
like image 291
Sean Kearon Avatar asked Jan 16 '23 02:01

Sean Kearon


1 Answers

There are couple of built-in ways to configure Quartz.NET, here's a small comparison.

  • Code based configuration
    • You use the scheduler API to create/update/delete jobs and triggers
    • Schedules and jobs configured by hard coding naturally require recompilation, using a UI or such with scheduler API and persistent job store is a different story
  • XML Configuration
    • You can schedule jobs and watch XML file for changes
    • See Can quartz.net reconfigure jobs when config file changes? for example of watching for file changes
    • There is no tooling available as far as I know besides intellisense with Visual Studio when you have the XSD file associated with XML file

Then again, you have job store options. You can use any job store regardless of the way you configure your scheduler/jobs/triggers.

  • RAMJobStore
    • Fastest (but usually not a factor) and simplest to setup job store but no way to recover from missed trigger fires caused by server reboots etc
  • AdoJobStore
    • Stores triggers, jobs and their states between restarts and allows you to run Quartz.NET clustered for fail-over and scale

There are also couple web based administration UI available, see Any open-source admin UI for quartz.NET for details.

The Quartz.NET tutorial is always a good place to start too.

like image 137
Marko Lahma Avatar answered Feb 19 '23 17:02

Marko Lahma