Next version of kbmMW will continue to improve on the already very powerful job scheduler built into the framework.
Now UNIX CronTab like scheduling can be made. Examples:
// At the 8 and 9 minutes past the hour Scheduler.Schedule(OnTestEvent).Cron('8,9 * * * * *').NamedAs('cron1').Activate; // At the exact minute of the hour when this event is scheduled Scheduler.Schedule(OnTestEvent).Cron('? * * * * *').NamedAs('cron2').Activate; // Every 5 minutes Scheduler.Schedule(OnTestEvent).Cron('*/5 * * * * *').NamedAs('cron3').Activate; // Every minute at Monday between 8:20 and 8:30 Scheduler.Schedule(OnTestEvent).Cron('20-30 8 * * Mon *').NamedAs('cron4').Activate; // Every second minute at Monday between 8:20 and 8:30 Scheduler.Schedule(OnTestEvent).Cron('20-30/2 8 * * 1 *').NamedAs('cron5').Activate; // Every second minute at Monday and Tuesday between 8:20 and 8:30 Scheduler.Schedule(OnTestEvent).Cron('20-30/2 8 * * 1,2 *').NamedAs('cron6').Activate; // Every second minute at Monday and Tuesday, in March between 8:20 and 8:30 Scheduler.Schedule(OnTestEvent).Cron('20-30/2 8 * mar 1,2 *').NamedAs('cron7').Activate;
kbmMW supports an extended CronTab format which includes these features.
- Optional year
- List of values
- Ranges
- Intervals
- Optional textual day of week
- Optional textual month name
- Start time indicator
Syntax for cron: minute hour day month dayofweek year
Year is optional.
Thus 5 or 6 space separated values must be given.
Each of the values can be:
* indicating any value.
? indicating value at schedule time
1,2,3.. list of values
1,4-5,7… list of values
1-5 range of values
*/2 interval… every 2
3-15/3 interval… every 3 starting at 3, ending at 15
Interval values can be used for minute, hour, day, month and year values.
Month can be given as a value 1..12 or text jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec.
DayOfWeek can be given as value 1 (monday)..7 (sunday) or mon, tue, wed, thu, fri, sat, sun.
All the other fluent expression supported by kbmMW’s scheduler, like InitialDelay, Starting, Ending, Occurance etc. can be added after the Cron statement.
In addition to Cron, a number of fluent methods like AtYears, AtMonths, AtDays, AtHours, AtMinutes, AtSeconds has been added to allow setting up Cron like schedules without using the Cron string format.
kbmMW Scheduler Tidbits #1 – Async methods
[…] kbmMW Scheduler Tidbits #2 […]
[…] kbmMW Scheduler Tidbits #2 – CRON […]
[…] kbmMW Scheduler Tidbits #2 – CRON […]