Reputation: 105
I need to poll after deployment immediately i.e 0 seconds and then for every 45 mins using cron
Should poll as follows:: 00:00, 00:45, 1:30,2:15,3:00 and so on
Upvotes: 1
Views: 2566
Reputation: 2324
run every 10 seconds
0/10 * * * * ?
run every 45 minutes
* 0/45 * * * ?
Upvotes: 1
Reputation: 7
Instead of using the Cron jobs just go with fixed frequency scheduler simply. set the value as follows:
frequency: 45 start delay as :0
Time unit as:minutes
Upvotes: -1
Reputation: 357
Simply use the fixed frequency scheduler construct as stated by @Mooz and then get the current time, check if it is a Sunday and do not process if it is. A cron expression is not really directly intended to handle all of the constraints of running immediately, a frequency relative to starting time rather than a clock schedule, and a day scheduling even with Mule's extensions to cron. Other solutions would be to use two controllers, but this would seem cleaner to me.
Upvotes: 0
Reputation: 11
Cron expression (for every 45 mins): 0 0/45 * 1/1 * ? *
If you want to run every 45 mins(00:15,01:00 like this) use quartz. if you used poll operation it will not run every 45 mins, it will run every 45 mins when the project or flow deployed.
Upvotes: 0
Reputation: 863
Why do you have to use cron?
Your best bet in this case is to not use cron, rather use Mule's in-built fixed-frequency scheduler:
Note how the the default delay is "0" which means that it will run immediately upon deployment, then will run every 45 minutes after.
Here is the configuration-xml:
...
<flow name="polling-frequency-example-flow"
processingStrategy="synchronous">
<poll doc:name="poll-every-forty-five-mins">
<fixed-frequency-scheduler frequency="45" timeUnit="MINUTES"/>
</poll>
<!-- Do Something -->
</flow>
...
Upvotes: 2
Reputation: 341
CRON expression to poll every 45 minutes, this will solve ur first problem.
0 0/45 * 1/1 * ? *
Running once immediately after the deployment can't be handled with "Poll" as far as I know. As a workaround, in addition to the Poll component above, create another flow with "QUARTZ Inbound Endpoint" and it has a repeatCount attribute which you can set it to "Zero"(this will run exactly once and won't repeat itself).
Upvotes: 0
Reputation: 1070
I don't know how to poll in Mule, but I can help you with your cron schedule.
Cron doesn't support every-45-minutes. You'll have to break it into three cronjobs:
Upvotes: 1