A routing key is a string carried with a RabbitMQ message. The message goes to an exchange, which uses the routing key, exchange type, and queue bindings to route it to one or more queues. Producers send messages to exchanges; consumers receive them from queues. section 9.2
Routing behavior depends on the exchange:
- Default exchanges route messages to a queue whose name matches the routing key. section 9.2
- Direct exchanges route messages when the routing key matches a binding key. section 9.2
- Topic exchanges match routing keys against binding keys that may contain wildcards. section 9.2
- Fanout exchanges deliver to all bound queues without considering routing keys. section 9.2
- Headers exchanges route using message headers instead of routing keys. section 9.2
Configuring a taco-order route
Spring Boot can configure RabbitTemplate with an exchange and routing key: exchange `tacocloud.order` and routing key `kitchens.central`. Sending code can then use RabbitTemplate to publish the order through the configured messaging setup. section 9.2.2
Figure 9.2 Messages sent to a RabbitMQ exchange are routed to one or more queues, based on routing keys and bindings.
Use the routing diagram to follow a message from its exchange through bindings to one or more queues. section 9.2
