Quartz Cron Expression: Run Job Every 1 hr 10 minutes 20 seconds starting NOW (immediately)

眉间皱痕 提交于 2020-01-07 11:02:11

问题


I want to run a job every 1 hr 10 minutes and 20 seconds.

For this i have tried with the following cron expression.

"0/4220 * * * * ?"

But I cannot set more than 60 seconds. what will be the cron expression for the above need?


回答1:


Instead of Quartz cron, we can use the simple trigger for this scenario.

In simple trigger we can use based on our need like the following.

We can convert the whole thing as seconds and we can repeat it.

For the 15 minutes and 10 seconds, I have used like the following. Even we can convert in minutes itself.

 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(); 


来源:https://stackoverflow.com/questions/43539823/quartz-cron-expression-run-job-every-1-hr-10-minutes-20-seconds-starting-now-i

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!