Choose the exchange
Direct, topic, fanout, and headers exchanges all use bindings, but each evaluates a different part of the message.
Route one AMQP message through direct, topic, fanout, and headers exchanges and see which queues receive a copy.
Publish one message and watch the exchange decide which queue bindings match. The same producer message can be routed by exact key, wildcard topic pattern, broadcast fanout, or message headers.
Direct, topic, fanout, and headers exchanges all use bindings, but each evaluates a different part of the message.
The producer sends to one exchange with a routing key and optional headers. It does not publish directly to a queue.
Each queue binding is a rule. Matching bindings receive a copy; non-matching bindings are skipped.
If nothing matches, RabbitMQ can route to an alternate exchange, return a mandatory message, or discard it.
A topic exchange compares a dot-separated routing key against each queue binding pattern.
The routing key matches the room temperature and all-sensors topic bindings, so the exchange sends copies to those queues.
* and # patterns.x-match logic.* matches exactly one routing-key word.# matches zero or more routing-key words.sensor.room.temp.x-match=all requires every listed header to match.x-match=any accepts one matching header.mandatory flag asks for a return if no route is available.sensor.#.