Global message routing forwards messages between queues or from a queue to an exchange across different instances, vhosts, or regions. It works like the open-source RabbitMQ Shovel plug-in.
Usage notes
-
Extra fees are incurred. Total cost = ApsaraMQ for RabbitMQ fees + EventBridge forwarding fees + Cloud Enterprise Network (CEN) traffic fees (cross-region only). ApsaraMQ for RabbitMQ: Billing of subscription instances. EventBridge: Billing. CEN: Billing rules.
-
Relay message routing is not supported. To forward messages from Instance A to Instance C, create a direct route. You cannot route through an intermediate Instance B.
-
Latency may occur during synchronization. High message volumes and limited network bandwidth can cause latency.
-
Limits are imposed on message size: The maximum message size of the destination instance must be greater than or equal to that of the source instance. Messages exceeding the destination limit fail to route and are lost.
Prerequisites
-
ApsaraMQ for RabbitMQ
The source and destination instances, vhosts, exchanges, and queues are created and available.
-
EventBridge
-
EventBridge is activated and the required RAM user permissions are granted. Activate EventBridge and grant permissions to a RAM user.
-
Create a global message routing task
-
Log on to the ApsaraMQ for RabbitMQ console. In the left-side navigation pane, click Shovel Task.
-
On the Shovel Task page, click Create Task.
-
(Optional) In the Alibaba Cloud Service Authorization - Message Queue RabbitMQ dialog box, read the message and click OK.
The first time you create a global message routing task, these service-linked roles are automatically created: AliyunServiceRoleForEventBridgeSourceRabbitMQ and AliyunServiceRoleForEventBridgeSendToRabbitMQ. Service-linked roles.
Note-
EventBridge assumes the AliyunServiceRoleForEventBridgeSourceRabbitMQ role to receive messages sent by the source instance.
-
EventBridge assumes the AliyunServiceRoleForEventBridgeSendToRabbitMQ role to forward messages to the destination instance.
-
-
On the Create Shovel Task page, configure the information about the source instance and destination instance of the message routing task.
-
In the Basic Information step, specify the task name and description and click Next.
-
In the Source and Destination step, configure the information about the source instance and destination instance of the message routing task and click Next.
Parameter
Description
Example
Source
Service Type
Instance type for the message source. Automatically set to Message Queue for RabbitMQ.
Message Queue for RabbitMQ
Region
Region of the source instance.
China (Shenzhen)
Instance
Source instance ID.
amqp-cn-i7m2a8bq****
vhost
Vhost on the source instance.
test-001
Queue
Queue on the source instance.
test-001-q
Destination
Service Type
Instance type for the message destination. Automatically set to Message Queue for RabbitMQ.
Message Queue for RabbitMQ
Region
Region of the destination instance.
China (Shenzhen)
Instance
Destination instance ID.
amqp-cn-7pp2a85q****
vhost
Vhost on the destination instance.
test-routing
Destination Type
Destination resource type. Valid values:
-
Queue: Forward messages to queues on the destination instance.
-
Exchange: Forward messages to exchanges on the destination instance.
NoteIf Destination Type is set to Exchange, ensure the destination exchange is bound to a queue. Otherwise, forwarded messages are lost.
test-routing-ex
Routing Key
Routing key for message forwarding. Available only when Destination Type is set to Exchange. Valid values:
-
Not Set: Use the existing routing key to forward messages.
-
Set: Use a custom routing key to forward messages.
test
-
-
In the Create and Start step, confirm the configurations of the message routing task and click Create and Start.
After creation, the task appears on the Shovel Task page with Running in the Status column.
-
References
Global message routing is compatible with the open-source RabbitMQ Shovel Plugin.