How to use¶
Previous pages¶
buildSchedule¶
Custom KronScheduler
You are always may create your own scheduler. In this section will be presented different ways and examples around standard CronDateTimeScheduler builders buildSchedule. You can read about schedulers in KrontabScheduler
Currently, buildSchedule is the recommended start point for every scheduler. Usually, it is look like:
Or:
On the top of any KronScheduler currently there are several groups of extensions:
- Executes
- Shortcuts
- Flows
Executes¶
All executes are look like do.... All executes are described below:
doOnce- will get the next time for executing, delay until that time and callblockwith returning of theblockresultdoWhile- will calldoOncewhile it will returntrue(that means thatblockmust returntrueif it expects that next call must happen). In two words: it will run whileblockreturningtruedoInfinity- will call theblockusingdoWhilewith predefined returningtrue. In two words: it will callblockwhile it do not throw error
Shortcuts¶
Shortcuts are the constants that are initializing in a lazy way to provide preset KronSchedulers. For more info about KrontabScheduler you can read its own page.
AnyTimeScheduler- will always return incomingDateTimeas nextEvery*Scheduler- return near * since the passedrelatively:EverySecondScheduler/KronScheduler.everyMillisecondEverySecondScheduler/KronScheduler.everySecondEveryMinuteScheduler/KronScheduler.everyMinuteEveryHourScheduler/KronScheduler.hourlyEveryDayOfMonthScheduler/KronScheduler.dailyEveryMonthScheduler/KronScheduler.monthlyEveryYearScheduler/KronScheduler.annually
Flows¶
Here currently there is only one extension for KronScheduler: KronScheduler#asFlow. As a result you will get Flow<DateTime> (in fact SchedulerFlow) which will trigger next emit on each not null next DateTime