ScheduleRule

sealed interface ScheduleRule

When a schedule is due: At an instant, After a delay counted from the commit that sets it, or by a Cron expression. A schedule is an aggregate's, under a key: set again, it is replaced; cancelled, it is gone.

Kinds may be added, each read by every node before one writes it, in two steps as Misfire's cases are, so a when over them keeps an else branch; firstDue answers for any kind.

Cases may be added in a minor release, so a when over it keeps an else branch.

Inheritors

Types

Link copied to clipboard
class After @InternalWowApi constructor(val millis: Long) : ScheduleRule

Due once, millis after the commit that sets it.

Link copied to clipboard
class At @InternalWowApi constructor(val epochMillis: Long) : ScheduleRule

Due once, at epochMillis.

Link copied to clipboard
object Companion
Link copied to clipboard
class Cron @InternalWowApi constructor(val expression: String, val timeZone: String = UTC, val misfire: Misfire = Misfire.COALESCE) : ScheduleRule

Due at each time expression names, read in timeZone, six fields as Spring's CronExpression reads them; a time missed while no node fired it is handled as misfire says. The runtime evaluates it: the first slot is the first time after the commit that sets it, and each next one the first time after the slot before it.

Functions

Link copied to clipboard
abstract fun firstDue(commitTime: Long): Long?

The first time the schedule is due, in epoch milliseconds, when it is set by a commit at commitTime; null when the rule is evaluated by the runtime, as a Cron rule is.