Before i re-engineer the wheel has anyone found a great library to do cron like jobs on KTOR?
1 Like
I’d started to do it, but didn’t finish yet: GitHub - Scogun/kcron-jobs: KCron Recurring Actions
val scheduledEventFlow = flow{
while(true){
delay(5.minutes)
emit(event())
}
}
scheduledEventFlow.onEach{ doScheduledJob() }.launchIn(scope)
Do you need anything else?
2 Likes
What if you need to run some event last day of every month?
You can use http://www.quartz-scheduler.org/ for example
1 Like
It look like “KCron” targets Android. Referencing Android libs in a server application would be at least uncommon.
For as server application something like Quartz would be a better fit. It does not only offer a lot of scheduling features but is also able to run in a cluster to avoid down times.
1 Like