AMQP Exchange Routing Workbench

Route one AMQP message through direct, topic, fanout, and headers exchanges and see which queues receive a copy.

animation
amqp
protocols
messaging
routing
Interactive AMQP exchange routing animation showing direct exact-match routing, topic wildcard routing, fanout broadcasts, headers x-match routing, unroutable messages, mandatory returns, and alternate exchange fallback.
AMQP Exchanges Bindings Routing

AMQP Exchange Routing Workbench

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.

Exchange Topic
Matched queues 2
Unroutable path Not needed
Active rule Topic wildcard
1

Choose the exchange

Direct, topic, fanout, and headers exchanges all use bindings, but each evaluates a different part of the message.

2

Publish a message

The producer sends to one exchange with a routing key and optional headers. It does not publish directly to a queue.

3

Inspect the bindings

Each queue binding is a rule. Matching bindings receive a copy; non-matching bindings are skipped.

4

Handle misses

If nothing matches, RabbitMQ can route to an alternate exchange, return a mandatory message, or discard it.

Topic exchange: wildcard routing

A topic exchange compares a dot-separated routing key against each queue binding pattern.

key: sensor.bldg1.temperature headers: sensor, normal, bldg1, json
1. PublishProducer sends to one exchange.
2. ExchangeThe exchange receives the publish.
3. BindingsRules are evaluated one by one.
4. CopiesMatched queues receive copies.
5. ResultThe delivery result is visible.
AMQP exchange routing animation A producer publishes a message to an AMQP exchange. The exchange evaluates bindings and routes copies to matching queues or handles an unroutable message. Producer basic.publish routing key Topic topic exchange Room temperature sensor.*.temperature binding All sensors sensor.# binding Critical alerts alert.critical.# binding Building 1 sensor.bldg1.# binding Alternate queue basic.return ! Publish to the exchange, then step through binding evaluation. Matched queues receive message copies; unmatched bindings stay idle.
Matched route Evaluated but skipped Unroutable result

Routing Decision

The routing key matches the room temperature and all-sensors topic bindings, so the exchange sends copies to those queues.

Queue Results

    Decision trace
    
          

    Exchange types

    • Direct: binding key must equal the routing key.
    • Topic: dot-separated words match * and # patterns.
    • Fanout: every bound queue receives a copy.
    • Headers: header values are compared with x-match logic.

    Topic wildcard rules

    • * matches exactly one routing-key word.
    • # matches zero or more routing-key words.
    • AMQP topic separators are dots, for example sensor.room.temp.

    Headers exchange

    • The routing key is not used for matching.
    • x-match=all requires every listed header to match.
    • x-match=any accepts one matching header.

    Unroutable messages

    • Without a match, a normal publish can be discarded.
    • An alternate exchange can route the miss to a fallback queue.
    • The mandatory flag asks for a return if no route is available.

    IoT patterns

    • Use topic exchanges for telemetry families such as sensor.#.
    • Use direct exchanges for commands with exact operation keys.
    • Use fanout exchanges for fleet-wide alerts or cache invalidation.

    Mental model

    • The producer sends to an exchange, not a queue.
    • Bindings are the exchange routing table.
    • One message can be copied to several queues when several bindings match.