Binding a RabbitMQ Queue
Binding a queue is to relate an exchange to a queue. In this way, producers send messages to exchanges and exchanges route these messages to related queues.
This section describes how to bind queues for an exchange on the console. Exchanges with queues bound can route and store messages to the queues. An exchange can be bound with multiple queues.
Notes and Constraints
- In RabbitMQ 3.x.x, the exchange (AMQP default) cannot be bound with any queue.
- Internal exchanges can only be bound with exchanges and not queues.
Prerequisites
- An exchange has been created.
- A queue has been created.
Binding a Queue to an Exchange
- Log in to the console.
- In the upper left corner, click and select a region.
Select the region where your RabbitMQ instance is.
- Click and choose Middleware > Distributed Message Service for RabbitMQ to open the console of DMS for RabbitMQ.
- Click an instance name to go to the instance details page.
- In the navigation pane, choose Virtual Hosts.
- Click a virtual host name.
- On the Exchange tab page, click Bind Exchange in the row containing the desired exchange. The Bind Exchange page is displayed.
- Click Add Binding. The Add Binding dialog box is displayed.
- Set the parameters by referring to Table 1.
Table 1 Binding parameters Parameter
Description
Type
Only RabbitMQ 3.x.x instances have this parameter. RabbitMQ AMQP-0-9-1 instances only support binding queues.
Select the binding type: To bind a queue, select Queue.
Target
Select a target queue to be bound.
Routing Key
Enter a key string to inform the exchange of which queues to deliver messages to.
- This parameter is required by direct exchanges and topic exchanges. Such exchanges route messages to queues with the routing keys matched. If this parameter is not set, exchanges route messages to all the bound queues.
- Enabling x-consistent-hash exchanges requires a routing key which indicates the weight of a queue. The larger the key, the heavier the weight, which means that the queue receives more messages.
- For fanout exchanges and header exchanges, skip this parameter.
- Click OK.
On the Bindings page, view the bound queue.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot