RabbitMQ
What is it?
RabbitMQ is a message broker that reliably passes messages between programs, so one part of a system can hand work to another without waiting.
Explain like I'm 5
Why was it created?
Programs that call each other directly are fragile and tightly coupled. RabbitMQ was created to decouple them by reliably queuing and routing messages.
Where is it used?
- Background job processing
- Decoupling microservices
- Task distribution to workers
- Smoothing traffic spikes
Why should developers care?
Message brokers are core to background processing and decoupled systems, and RabbitMQ is one of the most popular, so backend developers use it often.
How does it work?
Producers send messages to exchanges, which route them into queues based on rules. Consumers read from queues and acknowledge each message, so unacknowledged work can be redelivered.
Real-world example
When a user uploads a video, the web app drops a 'process video' message on a queue; worker processes pick it up and transcode it in the background.
Common use cases
- Background and async tasks
- Work distribution across workers
- Decoupling services
- Reliable task delivery
Advantages
- Reliable delivery with acknowledgements
- Flexible routing via exchanges
- Decouples producers and consumers
- Mature and widely used
Disadvantages
- Not built for huge event-stream replay (Kafka fits that)
- Throughput limits vs streaming systems
- Operational care needed for durability
When should you use it?
For task queues and decoupled request/work patterns where reliable delivery matters.
When should you avoid it?
For massive, replayable event streams — Kafka is a better fit.
Alternatives
Related terms
Interview questions
Beginner
- What is a message broker?
- What is a queue?
Intermediate
- What is an exchange in RabbitMQ?
- Why acknowledge messages?
Senior
- When would you choose RabbitMQ over Kafka?
- How do you guarantee a message isn't lost?
Common misconceptions
- "RabbitMQ and Kafka are interchangeable" — RabbitMQ is a broker/queue; Kafka is a durable, replayable log.
- "Messages are never lost by default" — you must configure durability and acknowledgements.
Fun facts
- It implements the AMQP messaging protocol.
- Exchanges decide how messages are routed to queues using binding rules.
Timeline
- 2007 — First released
Learning resources
Quick summary
RabbitMQ is a reliable message broker that queues and routes messages between programs, decoupling them for async and background work.
Cheat sheet
- Message broker / task queue
- Exchanges route to queues
- Acknowledgements ensure delivery
- Decouples producers and consumers