New: Cookbooks and AI ExplanationsStep-by-Step recipes to solve problems connected to Roadmaps and Cheat Sheets. Need more details? Use AI buttons for structured and simple explanations with concrete examples throughout the whole platform.Take a look
My FastAPI endpoint still blocks on the slow part, and BackgroundTasks disappears the moment the process restarts.
What you'll have at the end
A worker process, separate from your web app, that pulls one job off a durable queue, completes it, and leaves the finished report exactly where your app already looks for it.
You need
A working endpoint whose slow part is a plain function you can call and time directly, plus a running message broker your code can already connect to.
Not covered
Choosing which broker or protocol this queue should run on, and making a job safe to run twice once it has a side effect like a charge or an email.
Leans on
Email new signups without blocking your response
reach for that instead when the job is a small, truly fire-and-forget side effect, since losing it occasionally would not matter.
Stop a crash from losing a job nobody acknowledged
go there for what actually happens when a worker is killed mid-job and how to prove nothing is silently dropped.
Make your queue consumer idempotent
go there once the job has a side effect that must never fire twice, like a charge or an outbound email.
Should this event stream run on RabbitMQ or Kafka?
go there before committing to which broker or protocol this queue should actually run on.
Checked 19 Aug 2026
Part of the Message Queues cookbook