Job Type
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")Content copied to clipboard
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.