RabbitMQ

RabbitMQ is an open-source message broker that implements the AMQP protocol along with several others (MQTT, STOMP). Where Kafka is a log-oriented streaming platform, RabbitMQ is a flexible message router optimised for traditional work queues, RPC, and complex routing topologies.

Core concepts

  • Producer. Publishes messages to an exchange.
  • Exchange. Routes messages to queues via bindings; types include direct, topic, fanout, headers.
  • Queue. A buffer that holds messages; consumers subscribe and receive in FIFO order.
  • Binding. A rule that connects an exchange to a queue, often with a routing key pattern.
  • Acknowledgement. Consumers ack messages after processing; un-acked messages are redelivered after timeout.

Routing patterns

  • Direct. Routing key must match exactly.
  • Topic. Routing key matches a pattern with wildcards (orders.*.created).
  • Fanout. Broadcast to every bound queue.
  • Headers. Route by message header values rather than routing key.

RabbitMQ vs Kafka

  • RabbitMQ. Lower latency, complex routing, traditional work queues, RPC patterns. Messages are removed after consumption.
  • Kafka. Higher throughput, durable append-only log, replay, stream processing. Messages persist for a configured retention period.

Subscribe to Sahil's Playbook

Clear thinking on product, engineering, and building at scale. No noise. One email when there's something worth sharing.
[email protected]
Subscribe
Mastodon