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.
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.
- 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
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.
- Message Queue for RabbitMQ
Create a message routing task
- Log on to the Message Queue for RabbitMQ console.
- In the left-side navigation pane, click Global Message Routing.
- On the Global Message Routing page, click Create Task in the upper-left corner.
- 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.
- In the Create Message Routing Task wizard, configure the information about the source instance and the destination instance
for message routing.
On the Global Message Routing page, you can view the created task of which Status is Running.
- On the Basic Information page, name the task in the Instance Name field and describe the task in the Description field.
- On the Source and Destination page, configure the following parameters for the source instance and the destination
Parameter Description Example Source Service 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 Destination Service 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 Routing Key The routing key that is used for message routing. This parameter is available only if Destination Type is set to Exchange. Valid values:
- Not Set: The routing key that exists is used to forward messages to the destination exchange.
- Set: The routing key that is being configured is used to forward messages to the destination exchange.
- On the Create and Start page, confirm the configuration of message routing and click Create and Start.
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.
- On the Global Message Routing page, search for a task by task name in the search box.
- 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
- Click Details to view the configuration of the message routing task.
- Click Stop 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.