Quartz.NET,每 x 周重复一次 [英] Quartz.NET, Recur Every x Weeks
问题描述
我需要使用 Quartz.NET 实现以下场景:
i need to implement the following scenario using Quartz.NET:
每 n 周重复一次:
周日和/或周一、周二、周三、周四、周五、周六...
Recur every n week(s) on:
Sunday and/or Monday, Tuesday, Wednesday, Thursday, Friday, Saturday...
例如,我可能会选择:星期一和星期四,每 2 周重复一次,这可能吗?
So for example i might select: monday and thursday, and recur every 2 weeks, is this possible?
我发现要走的路可能是使用 Cron 表达式,但到目前为止我还没有使用每 X 周重复一次"
I figure it out that the way to go might be using Cron Expressions, but i haven't had luck so far with the "Recur Every X Weeks"
谢谢!
推荐答案
这是我使用的解决方案...
This is the solution that i used...
当没有复发时,我使用 cron 触发器并选择日期并使其每周运行
When there is no recurence i use a cron trigger and select the days and make it run every week
E.G.0 0 * * 1,2,3
E.G. 0 0 * * 1,2,3
当每个选定的日期都有重复时,我添加一个 SimpleTrigger,基本上开始日期是星期几,然后我通过将重复次数乘以 7 来计算重复次数
when there is recurence for each selected day i add a SimpleTrigger, bassically the start date is the day of the week, and then i calculate the recurrence by multiplying the recurence for 7
所以我最终每天都会有一个简单的触发器.
So i will end up wit one simpletrigger for each day.
我希望这对其他人有帮助!
I hope this helps someone else!
这篇关于Quartz.NET,每 x 周重复一次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!