Background jobs and retries
A background queue lets a service accept work and finish it later.
How it works
Give the request a way to check progress rather than holding the connection open for the entire export. On retry, a worker can use the job identity to recognize an already recorded result. Decide which failures are temporary and which should become a visible final error.
Walk through an example
A request can enqueue an export and quickly return a job ID. A worker processes the export, records a result, and retries temporary failures when appropriate.
What to watch for
Jobs can be delivered more than once. Design repeated delivery to give the same outcome or use a durable record of work already completed.
Check your understanding
What property prevents a duplicate notification?
See the example and explanation
- Worked example
- Given
Email notification job is delivered twice. - Answer
Idempotent handling.
The worker uses a stable job identity to check whether this notification was already sent.