My team and I are trying to figure out a way to "load up" our Sql Server database with the Quartz.NET schema installed.
<add key="quartz.dataSource.default.provider" value="SqlServer-20"/>
For demo's, we've been storing our job-setups in .xml (quartz_jobs.xml).
My question is :
Is there a way to "load up" the scheduling data from .xml (quartz_jobs.xml) (Quartz.Simpl.RAMJobStore), and then "save it off" to a AdoJobStore (Quartz.Impl.AdoJobStore.JobStoreTX) ?
The reason is that our "start up" data could be easily written placed in the .xml.
Right now, the only way I see putting jobs into a AdoJobStore is "coding them up" in c# code through the Quartz.Net object model.
Or "playing back" some profiled TSQL (using Sql Profiler) :(
Direct question is above "(getting xml into sql-server)".....the higher level question is "How does one populate a AdoJobStore with start up data...that isn't "coding them up" in c# code.
EDIT: I'm putting in my code that works......using Marko's (accepted as the answer) response.
My configuration file:
<quartz>
<add key="quartz.plugin.xml.type" value="Quartz.Plugin.Xml.XMLSchedulingDataProcessorPlugin, Quartz" />
<add key="quartz.plugin.xml.fileNames" value="~/Quartz_Jobs_001.xml" />
<add key="quartz.plugin.xml.ScanInterval" value="10" />
<add key="quartz.jobStore.type" value="Quartz.Impl.AdoJobStore.JobStoreTX, Quartz" />
<add key="quartz.jobStore.driverDelegateType" value="Quartz.Impl.AdoJobStore.SqlServerDelegate, Quartz"/>
<add key="quartz.jobStore.dataSource" value="default"/>
<add key="quartz.dataSource.default.connectionString" value="Server=MyServer\MyInstance;Database=QuartzDB;Trusted_Connection=True;Application Name='quartz_config';"/>
<add key="quartz.dataSource.default.provider" value="SqlServer-20"/>
</quartz>
My code:
NameValueCollection config = (NameValueCollection)ConfigurationManager.GetSection("quartz");
ISchedulerFactory factory = new StdSchedulerFactory(config);
IScheduler sched = factory.GetScheduler();
sched.Clear();
sched.Start();
NOTE:
I had to call IScheduler.Start() for the values to persist to the database.
The consequence of adding this line:
<add key="quartz.plugin.xml.ScanInterval" value="10" />
was that I could add entries into the quartz_job.xml, and it would would (append-only) the data in the database (while the engine was running).
Aka, I can "add lookup data" (to the database) "on the fly"....without stopping the service. A nice little tidbit. Removing a job requires a restart.