The RoutingKey parameter specifies the binding's routing key.
Exchanges that use routing-key-based logic make some sort of comparison between the routing keys of incoming messages and this value to decide which messages should be forwarded to the specified queue. Examples of exchange types which use routing keys include:
- direct exchanges, which compare (for equality) the routing keys of incoming messages to the routing keys of each queue bound to them.
- topic exchanges, which match the routing keys of incoming messages against the routing pattern of each queue bound to them.
Not all exchange types make use of routing keys, in which case empty string can be passed for the RoutingKey parameter. Examples of exchange types which don't use routing keys include:
- fanout exchanges simply forward incoming messages to all queues bound to them, unconditionally.
- header exchanges only forward messages that include certain headers. When binding a queue to a header exchange, add items to the to describe the headers that eligible messages must have, and whether they must have any or all of those headers.
Note that the format of the RoutingKey parameter and/or the content of the may differ slightly between server implementations. Refer to your server's documentation to determine what it expects to receive for each exchange type that it supports.