Skip to content

Instantly share code, notes, and snippets.

@Dervall
Created April 3, 2012 13:48
Show Gist options
  • Save Dervall/2292142 to your computer and use it in GitHub Desktop.
Save Dervall/2292142 to your computer and use it in GitHub Desktop.
Making Quartz .NET work with a separate configuration file
Stuff this into your start method
// Configure the Scheduler
ISchedulerFactory schedFact = new StdSchedulerFactory();
// get a scheduler
IScheduler sched = schedFact.GetScheduler();
sched.Start();
Add to app config
<quartz>
<add key="quartz.scheduler.instanceName" value="JobScheduler" />
<add key="quartz.threadPool.type" value="Quartz.Simpl.SimpleThreadPool, Quartz" />
<add key="quartz.threadPool.threadCount" value="10" />
<add key="quartz.threadPool.threadPriority" value="Normal" />
<add key="quartz.jobStore.misfireThreshold" value="60000" />
<add key="quartz.jobStore.type" value="Quartz.Simpl.RAMJobStore, Quartz" />
<add key="quartz.plugin.xml.type" value="Quartz.Plugin.Xml.JobInitializationPlugin, Quartz" />
<add key="quartz.plugin.xml.fileNames" value="jobs.config" />
</quartz>
Make a jobs.config! Make sure it copies to the output folder
<?xml version="1.0" encoding="utf-8" ?>
<quartz xmlns="http://quartznet.sourceforge.net/JobSchedulingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0" overwrite-existing-jobs="true">
<job>
<job-detail>
<name></name>
<group></group>
<description></description>
<job-type></job-type>
<volatile>false</volatile>
<durable>true</durable>
<recover>false</recover>
<job-data-map>
<entry>
<key></key>
<value></value>
</entry>
</job-data-map>
</job-detail>
<trigger>
<cron>
<name></name>
<job-name></job-name>
<job-group></job-group>
<cron-expression>*/10 * * * * ? *</cron-expression>
</cron>
</trigger>
</job>
</quartz>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment