Back to Backend

What is a message queue and why do backends use background workers?

A message queue (RabbitMQ, SQS, Redis streams, NATS, Kafka in a broader sense) holds jobs or events that producers push and workers consume. The HTTP request can acknowledge quickly after enqueue, while email sending, image processing, or third-party webhooks run asynchronously. This improves tail latency, absorbs bursts, and gives you a place to implement retries, backoff, and dead-letter queues for poison messages. Ordering, exactly-once, and at-least-once semantics are the senior interview follow-ups: most systems are at-least-once, so your handlers must be idempotent.

API -> enqueue { job: 'sendEmail', to, templateId } -> worker process -> mail provider

Start simple: try this concept in a tiny project before moving to advanced tools.

asyncqueuesreliability

Want to check this topic right now?

Check this question