使用AdoJobStore删除持久作业

时间:2012-08-21 13:14:38

标签: c# quartz-scheduler quartz.net quartz.net-2.0

我们有使用以下配置运行石英的Windows服务。我们还有一个具有相同设置的mvc应用程序,用于维护集群的作业和触发器。但由于某种原因,即使作业持久,也会删除作业和触发器。

<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服务启动

    IScheduler scheduler = _schedulerFactory.GetScheduler();
    scheduler.JobFactory = _jobFactory;
    scheduler.Start();

MVC经理

    IScheduler scheduler = _schedulerFactory.GetScheduler();
    scheduler.AddJob(jobDetail, false);

1 个答案:

答案 0 :(得分:0)

我估计您必须更改 MVC Manager 的配置,如下所示:

<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>

我已将ThreadPool类型更改为 ZeroSizeThreadPool 并已删除

<add key="quartz.threadPool.threadCount" value="10" />
<add key="quartz.threadPool.threadPriority" value="Normal" />

您可以找到更多信息here