Build a Message Queue (RabbitMQ / SQS) (14 scenes)
Scene 01 · The work that can't block the request
Some side effects (email, PDF, transcode) are too slow for the HTTP request — drop them on a buffer and let a worker pool finish them asynchronously.
Scene 01
The work that can't block the request
Diagram
Two stacked lanes show the same submit request. Top lane is synchronous: the API holds the connection open while the slow job runs, and the dashed red line is the HTTP timeout the browser will not wait past. Bottom lane is asynchronous: the API acts as a **producer**, dropping a unit of work on the buffer and returning 200 OK in milliseconds, while the worker pool on the right acts as a **consumer**, pulling work off the buffer and finishing it on its own schedule.
API still blocked — past 5s timeout
Watch the top lane first: the API holds the connection open while a slow side effect runs, and the browser walks away at the timeout. Then the bottom lane runs the same submit — the API drops the work on a buffer, replies 200 OK in 50ms, and the workers pick it up afterward.