0.5.0
Added
Pulses can now be scheduled on a day of the week (#131)
clock.schedulePulse(onDayOfWeek = DayOfWeek.Monday).beat {
println("It's Monday!")
}You can now build complex representations of schedules using a type-safe DSL (#94)
clock.schedulePulse {
atMinute(0, 30)
onDaysOfWeek(DayOfWeek.Monday..DayOfWeek.Friday)
}.beat { scheduled ->
println("Scheduled at $scheduled, occurred at ${clock.now()}.")
}Pulse instances can be created from a standard Cron expression (#90)
These Cron expressions are standard. Standard Cron expressions include:
- Minutes, hours, days of month, months, and days of week fields
- Lists of values like
1,2,3 * * * * - Ranges of values like
* * * * 1-5
and do not include any extensions like:
- Special directives like
@monthlyor@reboot - Randomized ranges like
1~5 - Step ranges like
*/2 - Seconds or years fields
clock.schedulePulse("* * * * *").beat { println("Hello!") }Scheduling one-off jobs has a new API (#112)
val someInstant: Instant = // ...
clock.executeAt(someInstant) {
println("I executed at ${clock.now()}!")
}Changed
RecurringJobMode has been renamed PulseBackpressureStrategy (#107, #113, #115)
This name better reflects the intent of this type. Also, this class is no longer modeled as an enum for backwards compatibility reasons as I move towards a stable API.
Removed
Clock.delayFor and Clock.delayUntilNext have been removed (#96)
Did you use these APIs and will this cause an issue for you? File an issue and I'll reconsider including them.
Pulse.beat no longer exposes the Instant at which the invocation occurred (#122)
This was error prone in certain scenarios. If you need this information, you should instead invoke Clock.now directly in the lambda.
- clock.fixedPeriodPulse(10.seconds).beat { scheduled, occurred ->
+ clock.fixedPeriodPulse(10.seconds).beat { scheduled ->
+ val occurred = clock.now()
println("Scheduled at $scheduled, occurred at $occurred.")
}Clock.delayUntil has been removed (#112)
Use Clock.executeAt instead!