Search code examples
mulequartz-scheduler

Mule Quartz - Cron for all week days except 1st day of month


The cron expression 0 30 4 2-31 * MON-FRI * is invalid because of error:

java.text.ParseException: Support for specifying both a day-of-week AND a day-of-month parameter is not implemented.

But maybe there is another way to specify such cron expression:

Execute every weekday except first day of month on 4:30.

Is it possible using W parameter?

I'm using Quartz Crone expression in MuleSoft quartz:inbound-endpoint configuration.


Solution

  • http://www.quartz-scheduler.org/api/2.1.7/org/quartz/CronExpression.html

    Support for specifying both a day-of-week and a day-of-month value is not complete (you'll need to use the '?' character in one of these fields).

    You could use 0 30 4 ? * MON-FRI *

    At 04:30:00am, every day between Monday and Friday, every month

    You could do an expression filter check to see if today's date is not the first, and then proceed.

    <expression-filter expression="#[server.dateTime.getDayOfMonth() != 1]" doc:name="Expression"/>