Scheduler

hexagon_scheduler

Repeated tasks execution based on Cron expressions for Hexagon framework. It uses the Cron-utils Java Library.

Note

In some platforms I.e.: Kubernetes there is a way to execute repeated tasks, you should take advantage of them as using your own service will raise problems scaling those services' instances (you will have to coordinate them)

You can check an usage example in the following method:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
val cron = CronScheduler()
val times = 1
var count = 0

cron.schedule("0/1 * * * * ?") {
    count++
}

sleep((times * 1_000) + 100L)
cron.shutdown()
assert(count == times)

Packages

Name Summary
com.hexagonkt.scheduler Classes for scheduling blocks of code repeatedly based on a Cron expression.

Index

All Types

Comments