简体   繁体   中英

quartz.net automatic delete trigger

I am using quartz.net(2.2.X) in winform application(Visual Studio 2013),but when I invoke function, the program deletes the trigger automatically.

The task could execute only once.

This is my log snip:

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

This is my job configuration:

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

And this is my function to invoke job:

        #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

确保您的app.config没有石英节点配置。石英配置应写入app.configquartz.config文件,不允许两侧配置。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM