ScheduleSpec

The job instances of a scheduleSpec and the handlers of their jobs.

Constructors

Link copied to clipboard
constructor(handlers: List<ProcessorBinding<*>>, start: Instant = DEFAULT_START, partitions: Int = 1)

Properties

Link copied to clipboard
Link copied to clipboard

The time the specification is at.

Link copied to clipboard

The ticks the handlers got so far, in order.

Functions

Link copied to clipboard
fun advanceTime(duration: Duration, expect: ProcessorExpectations.() -> Unit? = null)

Moves the time on by duration: each instance runs the slots then due, and the handlers of its job get each tick, in order. expect checks what the handlers did with all of them together, and fails when no slot was due; without it, the step fails only when a handler or a job's command throws.

Link copied to clipboard
fun answerCalls(answer: (Command<*>) -> CommandResult)

Answers each synchronous call a handler makes with what answer returns, as ProcessorSpec.answerCalls does.

Link copied to clipboard
fun disable(job: String, tenantId: String = DEFAULT_TENANT, partition: Int? = null)

Disables job's instance in tenantId.

Link copied to clipboard
fun enable(job: String, tenantId: String = DEFAULT_TENANT, rule: JobRule? = null, partition: Int? = null)

Enables the instance of job in tenantId (the default tenant for a SYSTEM or a SHARDED job) by its default rule under rule, as wow.schedule.Enable does; the instance of partition for a SHARDED job. Fails when the instance refuses it.

Link copied to clipboard

Serves the handlers' reads from queries, as ProcessorSpec.givenQueries does.

Link copied to clipboard
fun instanceOf(job: String, tenantId: String = DEFAULT_TENANT, partition: Int? = null): JobState?

The state of job's instance in tenantId, or null when it was never enabled.

Link copied to clipboard
fun reschedule(job: String, tenantId: String = DEFAULT_TENANT, rule: JobRule? = null, partition: Int? = null)

Overrides the rule of job's instance in tenantId with rule, null to follow the default again.

Link copied to clipboard
fun whenTick(tick: ScheduleTick, expect: ProcessorExpectations.() -> Unit = {})

Hands tick to the handlers of its job directly, as the runtime would after its instance committed it, and checks what they did in expect.