This topic describes the global message routing feature and how to manage message routing tasks. This feature can help you route messages and synchronize data between different instances or between different vhosts based on your business requirements.

Background information

You can use the global message routing feature in the same manner in which you use the Shovel plug-in for open source RabbitMQ. You can use this feature to forward messages from a queue to another queue or from a queue to an exchange. The source and destination can belong to different instances or vhosts in the same region or different regions.

Note

  • The global message routing feature provided by Message Queue for RabbitMQ is available only if messages are forwarded between different instances, vhosts, or queues in the same region.
  • The global message routing feature incurs fees. You are charged based on the following formula:

    Total fees = Fees incurred by Message Queue for RabbitMQ + Forwarding fees incurred by EventBridge. For more information about the billing methods of Message Queue for RabbitMQ, see Billing for Message Queue for RabbitMQ. For more information about the billing methods of EventBridge, see Billing for EventBridge.

  • The global message routing feature does not support relay message routing. If you want to forward messages from Instance A to Instance C, messages cannot be forwarded from Instance A to Instance B and then to Instance C. In this case, you must create a route from Instance A to Instance C.
  • During message synchronization, the number of messages that you want to synchronize and the limited network bandwidth can cause latency.

Prerequisites

The source instance, vhost, exchange, and queue are created and available. The destination instance, vhost, exchange, and queue are created and available. For more information, see the following links:

Create a message routing task

  1. Log on to the Message Queue for RabbitMQ console.
  2. In the left-side navigation pane, click Global message routing.
  3. On the Global message routing page, click Create task in the upper-left corner.
  4. In the Alibaba Cloud Service Authorization- Message Queue RabbitMQ dialog box, read the message and click OK.
    When you create a message routing task for the first time, the following service-linked roles are automatically created: AliyunServiceRoleForEventBridgeSourceRabbitMQ and AliyunServiceRoleForEventBridgeSendToRabbitMQ. For more information, see Service-linked roles.
    Note
    • AliyunServiceRoleForEventBridgeSourceRabbitMQ: EventBridge uses this role to receive messages sent by the source instance.
    • AliyunServiceRoleForEventBridgeSendToRabbitMQ: EventBridge uses this role to forward messages to the destination instance.
  5. In the Create a message routing task wizard, configure the information about the source instance and the destination instance for message routing.
    1. On the Basic information page, name the task in the Instance Name field and describe the task in the Description field.
    2. On the Source and target page, configure the following parameters for the source instance and the destination instance.
      Parameter Description Example
      Synchronize source information Product type The type of the source instance from which you want to forward messages. This parameter is automatically set to Message Queue for RabbitMQ. Message Queue for RabbitMQ
      Region The region where the source instance is deployed. China (Shenzhen)
      Instance The ID of the source instance. amqp-cn-i7m2a8bq****
      Vhost The vhost that is created on the source instance. test-001
      Queue The queue that is created on the source instance. test-001-q
      Synchronize target information Product type The type of the destination instance to which you want to forward messages. This parameter is automatically set to Message Queue for RabbitMQ. Message Queue for RabbitMQ
      Region The region where the destination instance is deployed. China (Shenzhen)
      Instance The ID of the destination instance. amqp-cn-7pp2a85q****
      Vhost The vhost that is created on the destination instance. test-routing
      Destination Type The type of the destination object to which messages are forwarded. Valid values:
      • Queue: Messages are forwarded to one or more queues in the destination instance.
      • Exchange: Messages are forwarded to one or more exchanges in the destination instance.
        Note If the Destination Type parameter is set to Exchange, make sure that the destination exchange is bound to a queue. Otherwise, the messages that are forwarded to the destination exchange can be lost because no queue can be used to store the messages.
      test-routing-ex
      RoutingKey The routing key that is used for message routing. This parameter is available only if Destination Type is set to Exchange. Valid values:
      • Do not set: The routing key that exists is used to forward messages to the destination exchange.
      • Settings: The routing key that is being configured is used to forward messages to the destination exchange.
      test
    3. On the Create startup page, confirm the configuration of message routing and click Create and start.
    On the Global message routing page, you can view the created task of which Status is Running.

Related operations

Message Queue for RabbitMQ allows you to manage message routing tasks. For example, you can view the details of message routing tasks. You can disable, modify, and delete message routing tasks.

  1. On the Global message routing page, search for a task by task name in the search box.
  2. Find the task that you want to manage. In the Actions column, you can perform the following operations on the task based on your business requirements:
    • Click Details to view the configuration of the message routing task.
    • Click Deactivation to disable the message routing task.
    • Click Edit to modify the configuration of the message routing task.
    • Click Delete to delete the message routing task.