This topic describes how to create a message outflow task in the ApsaraMQ for RabbitMQ console to synchronize data from ApsaraMQ for RabbitMQ to ApsaraMQ for RocketMQ.
Prerequisites
An ApsaraMQ for RabbitMQ instance is purchased and deployed. Make sure that the instance is in the Running state. For more information, see Step 2: Create resources.
An ApsaraMQ for RocketMQ instance is purchased and deployed. Make sure that the instance is 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 RocketMQ and follow the on-screen instructions to configure other parameters. The following table describes the parameters.
Parameter
Description
Example
Version
The version of the ApsaraMQ for RocketMQ instance that you created.
RocketMQ 4.x
Instance ID
The ID of the ApsaraMQ for RocketMQ instance that you created.
test
Topic
The topic on the ApsaraMQ for RocketMQ instance that you created.
test
Message Body
EventBridge extracts data from an event by using JSONPath and routes the specified event content to the event target.
Data Extraction
$.data.bodyCustom Property
Select Template. You can specify a template and define the variables that are required in the template. EventBridge extracts fields from an event and transforms the event based on the template.
NoteIf you want to deliver all message attributes from the event source, we recommend that you use the sample code provided in the Example column of this table.
Parameters:
{ "userProperties":"$.data.userProperties", "msgId":"$.data.systemProperties.UNIQ_KEY" }Template:
{ "EB_SYS_EMBED_OBJECT":"${userProperties}", "UNIQ_KEY":"${msgId}" }Message Key
EventBridge extracts data from an event by using JSONPath and routes the specified event content to the event target.
Data Extraction
$.data.systemProperties.KEYSMessage Tag
EventBridge extracts data from an event by using JSONPath and routes the specified event content to the event target.
Data Extraction
$.data.systemProperties.TAGS
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.