This topic describes how to create a message outflow task in the ApsaraMQ for RabbitMQ console to synchronize data from one ApsaraMQ for RabbitMQ instance to another ApsaraMQ for RabbitMQ instance.
Prerequisites
ApsaraMQ for RabbitMQ instances are purchased and deployed. Make sure that the instances are in the Running state. For more information, see Step 2: Create resources.
EventBridge is activated and the required permissions are granted to a Resource Access Management (RAM) user. For more information, see Activate EventBridge and grant permissions to a RAM user.
Create a message outflow task
Log on to the ApsaraMQ for RabbitMQ console. In the left-side navigation pane, choose .
In the top navigation bar, select a region, such as China (Hangzhou). On the Tasks page, click Create Task.
On the Create Task page, configure the Task Name and Description parameters and follow the on-screen instructions to configure other parameters. Then, click Save. The following section describes the parameters:
Task Creation
In the Source step, set the Data Provider parameter to ApsaraMQ for RabbitMQ and follow the on-screen instructions to configure other parameters. Then, click Next Step. The following table describes the parameters.
Parameter
Description
Example
Region
The region that you selected in Step 2 of this section is used. You cannot change the value of this parameter.
China (Hangzhou)
ApsaraMQ for RabbitMQ Instance
The ApsaraMQ for RabbitMQ instance in which the messages that you want to route are produced.
amqp-cn-******lpc00a
vhost
The vhost of the ApsaraMQ for RabbitMQ instance in which the messages that you want to route are produced.
test
Queue
The queue on the ApsaraMQ for RabbitMQ instance in which the messages that you want to route are produced.
queue_test
Messages
The maximum number of messages that can be sent in each function invocation. Requests are sent only when the number of messages in the backlog reaches the specified value. Valid values: 1 to 10000.
100
Interval (Unit: Seconds)
The time interval at which the function is invoked. The system sends the aggregated messages to Function Compute at the specified time interval. Valid values: 0 to 15. Unit: seconds. The value 0 specifies that messages are sent immediately after aggregation.
3
In the Filtering step, define a data pattern to filter data in the Pattern Content code editor. For more information, see Event patterns.
In the Transformation step, specify a data cleansing method to implement data processing capabilities such as splitting, mapping, enrichment, and dynamic routing. For more information, see Use Function Compute to perform message cleansing.
In the Sink step, set the Service Type parameter to ApsaraMQ for RabbitMQ and follow the on-screen instructions to configure other parameters. The following table describes the parameters.
Parameter
Description
Example
Instance ID
The ApsaraMQ for RabbitMQ instance that you created.
amqp-cn-zvp2pny6****
vhost
The vhost that you created.
test
Destination Type
Exchange: A producer sends a message to an exchange, and then the exchange routes the message to one or more queues.
Queue: Each message is sent to one or more queues.
Queue
Exchange
The exchange to which events are routed on the ApsaraMQ for RabbitMQ instance. This parameter is required only if you set the Destination Type parameter to Exchange.
exchange
Queue
The queue to which events are routed on the ApsaraMQ for RabbitMQ instance. This parameter is required only if you set the Destination Type parameter to Queue.
queue
Message Routing Key
EventBridge extracts data from an event by using JSONPath and routes the specified content of the event to the event target. This parameter is required only if you set the Destination Type parameter to Exchange.
Data Extraction
$.data.key
Message Body
EventBridge extracts data from an event by using JSONPath and routes the specified content of the event to the event target.
Data Extraction
$.data.body
MessageId
EventBridge extracts data from an event by using JSONPath and routes the specified content of the event to the event target.
Data Extraction
$.data.props.messageId
EventBridge extracts data from an event by using JSONPath and routes the specified content of the event to the event target.
Data Extraction
$.data.props
Task Property
Configure the retry policy that you want to use when events fail to be pushed and the method that you want to use to handle faults. For more information, see Retry policies and dead-letter queues.
Other operations
On the Tasks page, find the task that you created and perform other operations in the Actions column.
View the details of the task: Click Details in the Actions column. In the Message Outflow Task Details panel, view the source configurations, destination configurations, and resources of the task.
Modify the configurations of the task: Click Edit in the Actions column. In the Modify Message Outflow Task panel, modify the configurations of resources and rules.
Enable or disable the task: Click Enable or Pause in the Actions column. In the Note message, click OK.
Delete the task: Click Delete in the Actions column. In the Note message, click OK.