RabbitMQ Fundamentals
Exchanges, queues, bindings, routing.
Queue — where messages actually sit waiting to be consumed. Exchange — receives published
messages and routes them to zero or more queues based on rules; producers publish to an exchange, not
directly to a queue (this indirection is exactly what enables pub/sub-style fan-out to multiple
consumers, same underlying idea as NServiceBus's Publish()).
Exchange types:
- Direct: routes by exact routing-key match.
- Fanout: routes to every bound queue, ignoring the routing key entirely — classic broadcast/event
publish.
- Topic: routes by wildcard pattern match on the routing key (order..created) — flexible
subscription filtering.
- Headers*: routes by matching message header values instead of the routing key.
Binding — the rule connecting an exchange to a queue (with a routing key/pattern for direct/topic exchanges).
NServiceBus's RabbitMQ transport builds its Send/Publish abstraction on top of exactly these primitives — a Command typically maps to a direct-routed queue (one destination), an Event typically maps to a fanout/topic exchange (potentially many subscriber queues).