This topic describes how to create a message inflow task in the ApsaraMQ for RabbitMQ console to synchronize data from Simple Message Queue (formerly MNS) to ApsaraMQ for RabbitMQ.
Prerequisites
An SMQ queue is created. For more information, see Activate SMQ and authorize RAM users to access SMQ.
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.
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.
Supported regions
When you create a message inflow task, you can use Simple Message Queue (formerly MNS) as the source in the following regions: China (Hangzhou), China (Shanghai), China (Qingdao), China (Beijing), China (Zhangjiakou), China (Hohhot), China (Shenzhen), China (Chengdu), China (Hong Kong), US (Silicon Valley), US (Virginia), Germany (Frankfurt), Singapore, Japan (Tokyo), Malaysia (Kuala Lumpur), and Indonesia (Jakarta).
Create a message inflow 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 Message Service (MNS) 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)
Queue Name
The Simple Message Queue (formerly MNS) queue in which messages that you want to route are produced.
test
Enable Base64 Decoding
By default, Base64 decoding is enabled. If you enable Base64 decoding, your data in Simple Message Queue (formerly MNS) is decoded in Base64 before the data is sent to the destination service.
None.
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 event content 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 Inflow Task Details panel, view the information about the source, destination, and resources.
Modify the configurations of the task: Click Edit in the Actions column. In the Modify Message Inflow Task panel, modify the resource configurations and rule configurations.
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.