Design a background job system: producers enqueue work with payloads; workers process jobs at least once with acks. Support retries with backoff, visibility timeouts, and separate queues for different job types (e.g. email vs. thumbnails).
Functional requirements
- Enqueue jobs with payload and optional delay or schedule time
- Workers dequeue, process, and ack or nack jobs
- Retry with exponential backoff and dead-letter queue after max attempts
- Optional priority or fairness between job types
Non-functional requirements
- Durability: enqueue survives broker or API restart
- Horizontally scalable workers with safe at-least-once handling
- Visibility timeout so crashed workers do not lose jobs permanently