Reputation: 29
I have a requirement to send email reminder to customers. I'm trying to trigger a Quartz job based on a datetime that is X weeks later after an event. In the Quartz job, I'm supposed to check for some condition whether it happened or not. If condition is false (e.g. no action from customer), I have to send another reminder Y weeks later. I then check again for the same condition, if false, I will send last reminder on a specific datetime that is known to me right at the start of this whole process.
Any idea how to construct the cron expression? Thanks
lyf
Upvotes: 1
Views: 893
Reputation: 35597
I suppose you're using C#, right? You can use this cron:
var CronReminderExpression = string.Format("0 0 9 1/{0} * ? *", (PeriodicityLength*7).ToString());
where PeriodicityLength is the number of weeks. I am multiplying for 7 cause there's no proper expression for weeks or, at least, I haven't been able to find it.
You can find a cron expression builder here.
Quartz.net 2.0 supports a new trigger called CalendarIntervalTrigger. You can read more here.
You can chain jobs this way.
Upvotes: 2