JobState

sealed interface JobState

The lifecycle of a job run.

Scheduled -> Enqueued -> Running -> Succeeded
| Failed (a retry is booked for retryAt)
| DeadLettered
| Cancelled

com.eventslooped.klokka.spi.JobStore.transition performs a compare-and-set on these values: a transition only applies if the stored state still equals the expected from state.

Inheritors

Types

Link copied to clipboard
data object Cancelled : JobState
Link copied to clipboard
data object DeadLettered : JobState

Retries exhausted or non-retryable failure. Kept for triage, never silently deleted.

Link copied to clipboard
data object Enqueued : JobState

Due and visible to workers.

Link copied to clipboard
data class Failed(val retryAt: Instant) : JobState

The last attempt failed and a retry is booked. Not terminal.

Link copied to clipboard
data object Running : JobState

Claimed under a lease and executing.

Link copied to clipboard
data object Scheduled : JobState

Waiting for its run-at time. Delayed jobs and schedule-emitted runs start here.

Link copied to clipboard
data object Succeeded : JobState

Properties

Link copied to clipboard

The JobStatus classifying this state.

Link copied to clipboard
open val terminal: Boolean

True when no further execution will happen for this run.