Background Jobs
Run durable, retryable work outside an interactive request.
Problem
Slow or failure-prone work should not hold a user request open.
When to use it
- Email, media, reconciliation, exports
- A pending state is acceptable
When not to use it
- Caller needs the result to proceed
- Fire-and-forget memory tasks
Minimal example
Persist job/outbox, acknowledge only after durable enqueue, lease work, make handler idempotent, record terminal failure.
Tradeoffs
- At-least-once execution
- Needs queue-age SLO, backpressure, replay, and cancellation