(Quick Reference)

routingKey

Purpose

The routing key is used in conjunction with an exchange to publish a message.

Examples

rabbitMessagePublisher.send {
    exchange = "example.exchange"
    routingKey = "example.topic"
    body = "message"
}

Description

The routing key is useful when publishing messages to topic or direct exchanges. When used on direct exchanges, the routing key must match the binding a queue used to bind to an exchange, or the message will become unroutable (and possibly lost). See the RabbitMQ documentation for more information on routing keys and exchanges.

The exchange can be omitted, in which case the routingKey can be used to send a message directly to a queue.