Durable Jobs being deleted using AdoJobStore
-
27-06-2021 - |
Question
We have windows service that runs quartz using the below configuration. We also have a mvc application with the same settings which is used to maintain the jobs and triggers for the cluster. But for some reason the jobs and triggers are being deleted, even if the job is durable.
<quartz>
<add key="quartz.scheduler.instanceId" value="AUTO" />
<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.Impl.AdoJobStore.JobStoreTX, Quartz" />
<add key="quartz.jobStore.tablePrefix" value="support.QRTZ_" />
<add key="quartz.jobStore.dataSource" value="myDS" />
<add key="quartz.jobStore.useProperties" value="true" />
<add key="quartz.jobStore.clustered" value="true" />
<add key="quartz.jobStore.clusterCheckinInterval" value="15000" />
<add key="quartz.dataSource.paymentsDS.connectionString" value="connString" />
<add key="quartz.dataSource.paymentsDS.provider" value="SqlServer-20" />
</quartz>
Windows Service Start
IScheduler scheduler = _schedulerFactory.GetScheduler();
scheduler.JobFactory = _jobFactory;
scheduler.Start();
MVC Manager
IScheduler scheduler = _schedulerFactory.GetScheduler();
scheduler.AddJob(jobDetail, false);
Solution
I reckon you have to change the configuration of your MVC Manager like this:
<quartz>
<add key="quartz.scheduler.instanceId" value="AUTO" />
<add key="quartz.threadPool.type" value="Quartz.Simpl.ZeroSizeThreadPool, Quartz" />
<add key="quartz.jobStore.misfireThreshold" value="60000" />
<add key="quartz.jobStore.type" value="Quartz.Impl.AdoJobStore.JobStoreTX, Quartz" />
<add key="quartz.jobStore.tablePrefix" value="support.QRTZ_" />
<add key="quartz.jobStore.dataSource" value="myDS" />
<add key="quartz.jobStore.useProperties" value="true" />
<add key="quartz.jobStore.clustered" value="true" />
<add key="quartz.jobStore.clusterCheckinInterval" value="15000" />
<add key="quartz.dataSource.paymentsDS.connectionString" value="connString" />
<add key="quartz.dataSource.paymentsDS.provider" value="SqlServer-20" />
</quartz>
I have changed the ThreadPool Type to ZeroSizeThreadPool and removed
<add key="quartz.threadPool.threadCount" value="10" />
<add key="quartz.threadPool.threadPriority" value="Normal" />
You can find more info here.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow