Skip to content
IT glossary
BackendUpdated December 3, 2026

RabbitMQ

This message broker routes messages between applications and holds them in queues until they can be delivered. The sender can move on without waiting for the receiving application to finish the work.

What RabbitMQ does

RabbitMQ is a message broker: a server that sits between applications that send messages and applications that process them. A web app can hand off a report-generation job and return a job ID immediately. A worker picks up the job later, so a burst of requests doesn't require the app to generate all the reports at once. Teams also use RabbitMQ to distribute events to services that act on them independently.

Follow a message through the broker

With AMQP 0-9-1, a producer publishes to an exchange. The exchange uses bindings to decide which queues should receive a copy. A queue holds messages for consumers; the exchange itself is not a backlog. Depending on the exchange type and bindings, one publish may reach zero, one, or several queues.

  • A direct exchange matches the routing key exactly against a binding key.
  • A topic exchange matches routing keys against patterns: report.* matches report.requested, but not report.pdf.requested.
  • A fanout exchange sends a copy to every bound queue, ignoring the routing key.

Publishing by queue name is a common shortcut. In AMQP 0-9-1 it uses the default exchange, which automatically has a binding for each queue under its name.

One queue or two?

Suppose both a PDF service and an audit service need the report.requested event. Give them separate queues bound to the same exchange so each service gets a copy. To increase PDF capacity, attach more workers to the PDF queue. Those workers compete for deliveries rather than each receiving a copy. Set prefetch to limit how many deliveries a worker can hold without acknowledging them.

What the acknowledgments actually tell you

A publisher confirm comes from RabbitMQ and tells the producer how the broker handled a publish. A positive confirm isn't proof that the message reached a queue: to detect unroutable publishes, set mandatory and handle returned messages. A consumer acknowledgment (ack) goes in the opposite direction, from the worker to the broker. Send it after the work succeeds, not merely when the message arrives.

If a worker commits to the database and crashes before the broker receives its ack, the same message can be delivered again. Use an idempotent handler, for example by recording a unique message ID in the same transaction as the business update. If a message keeps failing, immediate requeueing can create a tight loop. Limit retries and configure dead-letter routing so persistent failures can be inspected separately.

What interviewers look for

Expect to walk through a failure: What if the publisher loses its connection before receiving a confirm? Retrying an uncertain publish can produce duplicates, even if workers acknowledge correctly. You may also be asked what survives a broker restart. For a typical work queue, explain the difference between a durable queue, which preserves the queue definition across restarts, and persistent messages, which are needed if the queued work must survive too.