quartz.net自动删除触发器

时间:2015-05-12 07:28:11

标签: c# quartz.net

我在 winform 应用程序(Visual Studio 2013)中使用 quartz.net(2.2.X),但是当我调用函数时,程序会自动删除触发器。

任务只能执行一次。

这是我的日志剪辑:

2015-05-12 15:19:01,056 [TaskScheduler_QuartzSchedulerThread] DEBUG Quartz.Core.QuartzSchedulerThread [(null)] - Batch acquisition of 0 triggers
2015-05-12 15:19:01,141 [TaskScheduler_Worker-4] INFO  ProbeVideoUpdate [(null)] - 开始调度检测视频更新作业.....
2015-05-12 15:19:01,275 [TaskScheduler_Worker-3] INFO  NetStatusHelper [(null)] - Ping www.baidu.com    Success
2015-05-12 15:19:01,529 [TaskScheduler_Worker-3] INFO  NetStatusHelper [(null)] - 网络正常
2015-05-12 15:19:01,554 [TaskScheduler_Worker-4] INFO  PrintAPP [(null)] - Original Json address:http://api.zouwo.net/weixin/macData?id=1001
2015-05-12 15:19:01,625 [TaskScheduler_Worker-3] DEBUG Quartz.Core.JobRunShell [(null)] - Trigger instruction : DeleteTrigger   
2015-05-12 15:19:01,816 [TaskScheduler_Worker-3] DEBUG Quartz.Simpl.RAMJobStore [(null)] - Deleting trigger
2015-05-12 15:19:01,912 [TaskScheduler_Worker-4] INFO  NetStatusHelper [(null)] - isUpdate:0
2015-05-12 15:19:02,099 [TaskScheduler_Worker-4] DEBUG Quartz.Core.JobRunShell [(null)] - Trigger instruction : DeleteTrigger
2015-05-12 15:19:02,195 [TaskScheduler_Worker-4] DEBUG Quartz.Simpl.RAMJobStore [(null)] - Deleting trigger
2015-05-12 15:19:30,999 [TaskScheduler_QuartzSchedulerThread] DEBUG Quartz.Core.QuartzSchedulerThread [(null)] - Batch acquisition of 0 triggers
2015-05-12 15:19:56,247 [TaskScheduler_QuartzSchedulerThread] DEBUG Quartz.Core.QuartzSchedulerThread [(null)] - Batch acquisition of 0 triggers
2015-05-12 15:20:25,754 [TaskScheduler_QuartzSchedulerThread] DEBUG Quartz.Core.QuartzSchedulerThread [(null)] - Batch acquisition of 0 triggers
2015-05-12 15:20:54,907 [TaskScheduler_QuartzSchedulerThread] DEBUG Quartz.Core.QuartzSchedulerThread [(null)] - Batch acquisition of 0 triggers
2015-05-12 15:21:20,334 [TaskScheduler_QuartzSchedulerThread] DEBUG Quartz.Core.QuartzSchedulerThread [(null)] - Batch acquisition of 0 triggers
2015-05-12 15:21:48,070 [TaskScheduler_QuartzSchedulerThread] DEBUG Quartz.Core.QuartzSchedulerThread [(null)] - Batch acquisition of 0 triggers
2015-05-12 15:22:14,371 [TaskScheduler_QuartzSchedulerThread] DEBUG Quartz.Core.QuartzSchedulerThread [(null)] - Batch acquisition of 0 triggers

这是我的工作配置:

  <job>
      <name>ProbeVideoUpdateJob</name>
      <group>Group5</group>
      <description>侦测视频更新标识</description>
      <job-type>RRMall.WxPrint.Common.Cmd.ProbeVideoUpdate,RRMall.WxPrint.Common</job-type>
      <durable>true</durable>
      <recover>true</recover>
    </job>
    <trigger>
      <!--cron复杂任务触发器使用cron表达式定制任务调度-->
      <cron>
        <name>ProbeVideoUpdateTrigger</name>
        <group>Group6</group>
        <job-name>ProbeVideoUpdateJob</job-name>
        <job-group>Group5</job-group>
        <start-time>2014-10-25T00:00:00+08:00</start-time>        
        <cron-expression>0/3 * * * * ?</cron-expression>
      </cron>
    </trigger>

这是我调用工作的函数:

        #region InvokeProbeVideoUpdateJob
        public static void InvokeProbeVideoUpdateJob()
        {
            DateTimeOffset runTime = DateBuilder.EvenMinuteDate(DateTimeOffset.UtcNow);
            try
            {
                IJobDetail job = JobBuilder.Create<ProbeVideoUpdate>()
                                    .WithIdentity("ProbeVideoUpdateJob", "Group5")
                                    .Build();
                ITrigger trigger = TriggerBuilder.Create()
                                    .WithIdentity("ProbeVideoUpdateTrigger", "Group6")
                                    .StartAt(runTime)
                                    .Build();

                schedule.ScheduleJob(job, trigger);
                schedule.Start();
            }
            catch (Exception e)
            {
                logger.Error("侦测视频更新时时遇到错误", e);
            }
        }
        #endregion

1 个答案:

答案 0 :(得分:0)

确保你的app.config没有石英节点配置。石英配置应该写入 app.config quartz.config 文件,配置两者双方不许可。