An exchange is used to route a message received from a producer to one or more queues or discard the message. This topic describes how to create an exchange in the Message Queue for RabbitMQ console.
- Log on to the Message Queue for RabbitMQ console.
- In the top navigation bar, select the region where your instance resides.
- In the left-side navigation pane, click Exchanges.
- On the Exchanges page, select an instance and a vhost and click Create Exchange.
- In the Create Exchange dialog box, specify Exchange Name, Type, and Internal, and click Create.
Parameter Description Exchange Name The name of the exchange. The name of an exchange cannot start with amq., which is used as a reserved field. For example, amq.test is an invalid name. Type The type of the exchange. Valid values:
- fanout: An exchange of this type routes all the received messages to all the queues bound to this exchange. You can use a fanout exchange to broadcast messages.
- direct: An exchange of this type routes a message to the queue whose binding key is exactly the same as the routing key of the message.
- topic: This type is similar to the direct exchange type. An exchange of this type routes a message to one or more queues based on the fuzzy match or multi-condition match result between the routing key of the message and the binding keys of the current exchange.
- headers: This type is similar to the direct exchange type. The only difference is that a headers exchange uses the headers attribute instead of a routing key of the message for route matching. When you bind a headers exchange to a queue, you must configure binding attributes in the key-value format for the binding. When you send a message to a headers exchange, you must configure headers attributes in the key-value format for the message. After a headers exchange receives a message, it routes the message based on the matching between the headers attributes of the message and binding attributes of the bound queues.
- x-jms-topic: This type applies to JMS applications that access Message Queue for RabbitMQ by using a JMS API provided by Message Queue for RabbitMQ. This type of exchange routes a message to queues based on the fuzzy match result between the routing key and binding keys. Wildcards are used to support fuzzy match. For more information, see Overview.
Internal Specifies whether the exchange is an internal exchange. Valid values: true and false. Default value: false.
- true: The exchange is bound to another exchange.
- false: The exchange is bound to a queue.