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 callblock
with returning of theblock
resultdoWhile
- will calldoOnce
while it will returntrue
(that means thatblock
must returntrue
if it expects that next call must happen). In two words: it will run whileblock
returningtrue
doInfinity
- will call theblock
usingdoWhile
with predefined returningtrue
. In two words: it will callblock
while it do not throw error
Shortcuts¶
Shortcuts are the constants that are initializing in a lazy way to provide preset KronScheduler
s. For more info about KrontabScheduler
you can read its own page.
AnyTimeScheduler
- will always return incomingDateTime
as nextEvery*Scheduler
- return near * since the passedrelatively
:EverySecondScheduler
/KronScheduler.everyMillisecond
EverySecondScheduler
/KronScheduler.everySecond
EveryMinuteScheduler
/KronScheduler.everyMinute
EveryHourScheduler
/KronScheduler.hourly
EveryDayOfMonthScheduler
/KronScheduler.daily
EveryMonthScheduler
/KronScheduler.monthly
EveryYearScheduler
/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