2017-04-21 99 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();