Updated on 2024-11-27 GMT+08:00

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

Binding a Queue to an Exchange

  1. Log in to the console.
  2. In the upper left corner, click and select a region.

    Select the region where your RabbitMQ instance is.

  3. Click and choose Application > Distributed Message Service for RabbitMQ to open the console of DMS for RabbitMQ.
  4. Click an instance name to go to the instance details page.
  5. In the navigation pane, choose Virtual Hosts.
  6. Click a virtual host name.
  7. On the Exchange tab page, click Bind Exchange in the row containing the desired exchange. The Bind Exchange page is displayed.
  8. Click Add Binding. The Add Binding dialog box is displayed.
  9. Set the parameters by referring to Table 1.

    Table 1 Binding parameters

    Parameter

    Description

    Type

    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.
    • For fanout exchanges and header exchanges, skip this parameter.

  10. Click OK.

    On the Bindings page, view the bound queue.