[ACCEPTED]-Quartz.Net Job Storage Query-quartz.net

Accepted answer
Score: 18

you can use AdoJobStore.
Quartz.net will 40 use a set of tables with prefix QRTZ_ (you can 39 change it if you want) in your database 38 to stored jobs, triggers and status of these 37 objects.
I guess you want to have a table 36 in your DB where you're going to keep extended 35 information about your schedules, right?
You 34 won't access Quartz.net table directly cause 33 you will use the APIs provided by Quartz.net.

The 32 process to create a job detail and trigger 31 is straightforward and described very well 30 in the tutorials.

To configure your app to use the 29 AdoJobStore you have to specify few informations in 28 your app.config file. Here is an example:

    <add key="quartz.scheduler.instanceName" value="myApp" />
    <add key="quartz.scheduler.instanceId" value="MyApp" />
    <!-- Configure Thread Pool -->
    <add key="quartz.threadPool.type" 
                  value="Quartz.Simpl.SimpleThreadPool, Quartz" />
    <add key="quartz.threadPool.threadCount" value="10" />
    <add key="quartz.threadPool.threadPriority" value="Normal" />
    <!-- Configure Job Store -->
    <add key="quartz.jobStore.misfireThreshold" value="60000" />
    <add key="quartz.jobStore.type" 
                  value="Quartz.Impl.AdoJobStore.JobStoreTX, Quartz" />
    <add key="quartz.jobStore.useProperties" value="true" />
    <add key="quartz.jobStore.dataSource" value="default" />
    <add key="quartz.jobStore.tablePrefix" value="QRTZ_" />
    <add key="quartz.jobStore.lockHandler.type"  
              value="Quartz.Impl.AdoJobStore.UpdateLockRowSemaphore, Quartz" />
    <add key="quartz.dataSource.default.connectionString" 
        value="Server=SVSQL2008;Database=QuartzNet1;Trusted_Connection=True;" />
    <add key="quartz.dataSource.default.provider" value="SqlServer-20" />

There 27 are few things to keep in mind depending 26 if you're hosting Quartz.net in a web application 25 or a service or winform app. The best approach 24 is to create SchedulerFactory and Scheduler 23 as singleton. You can gather some more infos 22 here.


First of all you have to create Quartz.net 21 tables (see Step 1) and then you'll have to create 20 a few indexes for optiomization (see bottom 19 of the page).

Since you're going to submit your 18 jobs using the web app but you're not using 17 that app for the quartz.net events (triggers) you 16 don't need to start the scheduler. There 15 are few steps to follow on this side:

you 14 have to change the thread pool type to ZeroSizeThreadPool

<add key="quartz.threadPool.type" 
                   value="Quartz.Simpl.ZeroSizeThreadPool, Quartz" />

and 13 you have to define your StdSchedulerFactory 12 and Scheduler singleton. You can start during 11 the application (asp.net) bootstrap.

You're 10 never going to start the Scheduler (your 9 windows service is going to use that).

Another 8 thing to remember is you're going to need 7 share your job between your web and your windows 6 service, so it would be better to keep it 5 in a separate assembly.

You mentioned you're 4 storing some infos in one of your table. You 3 still need to have to submit your jobs and 2 trigger which will be persisted in Quartz.net 1 tables.

More Related questions