JobEvent

sealed interface JobEvent

In-process lifecycle events, emitted by the runtime as a hot kotlinx.coroutines.flow.SharedFlow. This is the only observability primitive in the core: metrics and tracing modules are built on it, and applications may subscribe directly for custom alerting.

Inheritors

Types

Link copied to clipboard
data class Cancelled(val jobId: JobId, val kind: String, val at: Instant, val scheduleId: String? = null) : JobEvent
Link copied to clipboard
data class DeadLettered(val jobId: JobId, val kind: String, val at: Instant, val attempts: Int, val error: Throwable, val scheduleId: String? = null) : JobEvent
Link copied to clipboard
data class Enqueued(val jobId: JobId, val kind: String, val at: Instant, val queue: QueueName, val scheduledFor: Instant, val scheduleId: String? = null) : JobEvent
Link copied to clipboard
data class FailedAttempt(val jobId: JobId, val kind: String, val at: Instant, val attempt: Int, val error: Throwable, val retryAt: Instant?, val scheduleId: String? = null) : JobEvent
Link copied to clipboard
data class ScheduleMisfired(val scheduleId: String, val kind: String, val at: Instant, val missedFires: Int, val policy: MisfirePolicy, val emitted: Int) : JobEvent

A recurring schedule came due later than its misfire threshold allowed. There is no per-run job id here because a misfire is a schedule-level fact: with MisfirePolicy.Skip no run exists at all. missedFires counts the fire times inside the missed window; emitted is how many runs the policy actually produced (0 for Skip, 1 for FireOnce, up to atMost for CatchUp).

Link copied to clipboard
data class Started(val jobId: JobId, val kind: String, val at: Instant, val attempt: Int, val queueWait: Duration, val scheduleId: String? = null) : JobEvent
Link copied to clipboard
data class Succeeded(val jobId: JobId, val kind: String, val at: Instant, val attempt: Int, val runDuration: Duration, val late: Boolean, val scheduleId: String? = null) : JobEvent

Properties

Link copied to clipboard
abstract val at: Instant
Link copied to clipboard
abstract val kind: String
Link copied to clipboard
abstract val scheduleId: String?

Id of the recurring schedule this event belongs to; null for directly enqueued jobs.