Producers, Exchanges, Queues & Routing
The Core Model
An open-source message broker implementing AMQP. A producer publishes messages; a consumer receives/processes them; they never talk directly — RabbitMQ decouples them in time, so the producer doesn't need the consumer immediately available, and the consumer processes at its own pace.
Exchanges & Bindings
Producers publish to an EXCHANGE, not directly to a queue. A binding connects an exchange to a queue (optionally with a routing key). Direct exchange — exact routing-key match. Fanout — broadcasts to every bound queue, ignoring the key. Topic — pattern match with wildcards, flexible partial routing.
producer --publish--> [exchange] --routing key match--> [queue] --> consumer
|
+--> [queue2] --> consumer2 (fanout: no key needed)Queue vs. Broadcast Patterns
One queue with multiple competing consumers = work distribution (each message to exactly ONE worker, round-robin — throughput scales by adding workers). A fanout/topic exchange bound to SEPARATE queues, each with its own consumer, = broadcast (every interested party gets its own copy of the same event).
RabbitMQ vs. Kafka
RabbitMQ: flexible routing, traditional message broker, moderate volumes. Kafka: distributed event-streaming, very high throughput, ordered/replayable logs — better fit for event sourcing or analytics pipelines. Choose based on whether the need is flexible task queuing or high-volume event streaming.
Keep your own version of these notes — editable, searchable, and organised by your stack.
Start free