JobType

class JobType<I, O>(source)

Describes one kind of job: the name it is persisted under, and the payloads it accepts and produces.

Declare one per worker and share it between the code that registers the worker and the code that enqueues jobs, so the compiler checks that both agree on the payload:

@Serializable
data class SyncInput(val since: Long)

@Serializable
data class SyncOutput(val items: Int)

val SyncJob = jobType<SyncInput, SyncOutput>("sync")

name is persisted with every enqueued job, so it has to stay stable across releases — unlike a class name, it survives obfuscation and refactoring.

Use Unit for a job that needs no input, no output, or neither.

Properties

Link copied to clipboard

Stable name this kind of job is persisted under.

Functions

Link copied to clipboard
open override fun toString(): String