Dan Storm
10/25/2023, 10:42 AMmarcospereira
10/25/2023, 1:19 PMDan Storm
10/25/2023, 1:20 PMmarcospereira
10/25/2023, 1:21 PMDan Storm
10/25/2023, 1:23 PMmarcospereira
10/25/2023, 1:25 PMDan Storm
10/25/2023, 1:27 PMmarcospereira
10/25/2023, 1:30 PMjava -jar my-command.jar
.Dan Storm
10/25/2023, 1:36 PMmarcospereira
10/25/2023, 1:37 PMCasey Brooks
10/25/2023, 10:16 PM@Schedule
annotation to run repeated jobs on a custom schedule, which doesn’t need the kind of crontab+artisan CLI setup that you’d need in PHP. There’s also the Java stdlib Timer, which works similarly (and I believe the Spring Boot scheduler uses internally). These both just run in-process and don’t require much boilerplate or any additional infrastructure.
Libraries like Quartz (or similar libraries) are good if you want the jobs to be resilient to server restarts or the tasks to be distributed/locked across the whole server fleet. But they can also be pretty large and complex to use, and often require additional infrastructure like databases or Redis caches that can make them a bit overkill for simpler tasks.
Additionally, I’ve recently started experimenting with a new pure-Kotlin scheduling library that works on coroutines, and so might be feel more natural to use from Kotlin than Quartz or other java libraries. It’s still early in development and doesn’t even have snapshot builds available yet, but I’d love to get some feedback on it, because running Ballast Schedulers in Ktor is one of my main motivations for it! It’s meant to be a smaller, simpler library in the category of schedulers like Spring Boot and Timer, rather than the larger Quartz options.Mike Dawson
10/26/2023, 6:17 PM