Expand description
The queue work waits in until it is done: a backend the application picks.
Ojak runs the loops — claiming, retrying, giving up — and keeps nothing
between runs itself. What is queued lives in a Queue, so that it
survives a restart. As in Fedify, the queue is pluggable: ojak-postgres
keeps it in a table of its own, MemoryQueue keeps it in memory for
tests and for servers that can afford to lose it, and an application with
tables for the purpose already implements the trait over them.
Unlike Fedify’s, a queue here is claimed from rather than listened to. A worker claims jobs for a lease and then reports each one done, to be retried after a delay, or failed. A lease is what lets any number of workers in any number of processes share one queue: the two colours of a blue/green deploy both run one, and what a colour was holding when it stopped is handed out again when the lease lapses, not lost.
Structs§
- Job
- A job, claimed for processing.
- Memory
Queue - A
Queuein memory. - Memory
Record - A job’s state in a
MemoryQueue, for tests to inspect. - Queue
Error - A failure in the queue backend itself.
- Retry
Policy - When to try a failed job again: how many attempts a job gets, and how long to wait after each failure.
Enums§
- Backoff
- How long to wait before trying a failed job again.
Traits§
- DynQueue
- A
Queuebehind a pointer, for where the backend is chosen at run time: an application with a database per tenant hands Ojak a different queue for each request. AnyQueueis one;sharedmakes aSharedQueue. - Queue
- A queue backend.
Functions§
- shared
queueas aSharedQueue.
Type Aliases§
- Shared
Queue - A queue shared behind a pointer; see
DynQueue.