My team and I are trying to find a way to "download" our Sql Server database with the Quartz.NET schema installed.
<add key="quartz.dataSource.default.provider" value="SqlServer-20"/>
For demonstration, we save our job settings in .xml (quartz_jobs.xml).
My question is:
Is there a way to “load” planning data from .xml (quartz_jobs.xml) (Quartz.Simpl.RAMJobStore) and then “save it” to AdoJobStore (Quartz.Impl.AdoJobStore.JobStoreTX)
The reason is that our “start-up” data can be easily written to an XML file.
Right now, the only way I see job placement in AdoJobStore is to “encode” them in C # code through the Quartz.Net object model.
Or "playback" of some TSQL profiled (using Sql Profiler): (
The direct question above is "(getting xml in sql-server)" ..... a higher level question: "How to populate an AdoJobStore using data launch ... it's not" encoding "in C # code.
EDIT: I embed my code that works ... using Marco's answer (accepted as the answer).
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 is:
NameValueCollection config = (NameValueCollection)ConfigurationManager.GetSection("quartz");
ISchedulerFactory factory = new StdSchedulerFactory(config);
IScheduler sched = factory.GetScheduler();
sched.Clear();
sched.Start();
Note:
I needed to call IScheduler.Start () to store the values in the database.
The consequence of adding this line:
<add key="quartz.plugin.xml.ScanInterval" value="10" />
it was that I could add entries to the quartz_job.xml file, and it could (add only) the data in the database (while the engine was running).
Aka, I can "add search data" (to the database) "on the fly" .... without stopping the service. Nice little tidbit. To delete a job, a reboot is required.