Background Jobs & Task Queues
Move slow or unreliable work out of the request path into a task queue with retries, idempotency and visible job status.
4 objectives 6 steps about 125 min
Learn it step by step
Read the lessons in order, try the practice checks, then prove the skill with the knowledge check.
This skill page is a public outline. Its lessons and knowledge check appear here as subject-matter experts approve them.
Learning objectives
- Decide which work belongs in the request path and which in a background job, explain why in-process background tasks are not durable, and say when a pub/sub topic or event log fits better than a task queue.
- Run a worker on a broker-backed task queue, enqueue jobs from an endpoint and expose job status to clients with 202 Accepted and a status resource.
- Make jobs safe under at-least-once delivery with idempotent handlers, bounded retries with backoff, time limits and a dead-letter path.
- Enqueue jobs consistently with database writes (transactional outbox or enqueue-after-commit) and run periodic jobs on a schedule.
Lesson plan
6 steps, about 125 min · 5 of 5 lessons available so far
- What Belongs Outside the Request, and Which Broker Fits Concept · 20 min
- Lab: A Worker, a Broker and a Status Endpoint Lab · 30 min
- Designing Jobs for At-Least-Once Delivery Concept · 20 min
- Enqueue After Commit with an Outbox Table Worked example · 25 min
- Scheduled Jobs and Running Workers Day to Day Concept · 15 min
- Check: What Happens When the Worker Dies? Knowledge check · 8 questions
Practise it
Add an 'export my data' feature: the endpoint returns 202 with a job resource, a Redis-backed worker builds and stores a CSV, transient failures retry with backoff, re-running the same job does not duplicate output, and an outbox table ensures no job is lost if the API crashes right after commit. Crash once after database commit and once after publishing before the outbox is marked sent; the job must remain discoverable, its handler must tolerate duplicate delivery and the finished export must be accessible only to its owner.
References
Hard prerequisites
None.
Unlocks
Nothing depends on this skill yet.
On these roadmaps
Progress and evidence for this skill are shared across all of them.