2017-04-21 97 views
-1

我想每1小时运行一次工作10分20秒。Quartz Cron Expression:Run Job每1小时10分钟20秒立即开始(立即)

为此,我尝试使用以下cron表达式。

"0/4220 * * * * ?" 

但我不能设置超过60秒。 以上需求的cron表达式是什么?

+0

这里的石英的约cron的表情官方文档:http://www.quartz-scheduler.org/documentation/quartz-2.x/tutorials/crontrigger.html约'SimpleTrigger'适合你最好的http: //www.quartz-scheduler.org/documentation/quartz-2.x/tutorials/tutorial-lesson-05.html – walen

回答

0

代替Quartz cron,我们可以在这个场景中使用简单的触发器。

在简单的触发器中,我们可以根据我们的需要使用,如下所示。

我们可以将整个事情转换为秒,我们可以重复它。

对于15分钟和10秒钟,我已经使用了以下内容。即使我们可以在几分钟内自行转换。

ITrigger trigger = TriggerBuilder.Create() 
.WithIdentity("trigger3", "group1") 
.WithSimpleSchedule(x => x 
    .WithIntervalInSeconds(910) 
    .RepeatForever()) // note that 10 repeats will give a total of 11 firings 
.ForJob(job) // identify job with handle to its JobDetail itself     
.Build();