All Products
Search
Document Center

ApsaraMQ for RocketMQ:ApsaraMQ for RabbitMQ

Last Updated:Dec 04, 2024

This topic describes how to create a message outflow task in the ApsaraMQ for RocketMQ console to synchronize data from ApsaraMQ for RocketMQ to ApsaraMQ for RabbitMQ.

Prerequisites

  • An ApsaraMQ for RocketMQ instance is purchased and deployed. Make sure that the instance is in the Running state. For more information, see Create resources.

  • 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.

Create a message outflow task

  1. Log on to the ApsaraMQ for RocketMQ console. In the left-side navigation pane, choose Message Integration > Tasks.

  2. In the top navigation bar, select a region, such as China (Hangzhou). On the Tasks page, click Create Task.

  3. In the Create Task page, configure the Task Name and Description parameters. Then, follow the on-screen instructions to configure other parameters. The following section describes the parameters:

    • Task Creation

      1. In the Source step, set the Data Provider parameter to ApsaraMQ for RocketMQ 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 when you created the message outflow task is automatically filled.

        China (Hangzhou)

        Version

        The version of the ApsaraMQ for RocketMQ instance in which the messages that you want to route are produced. Valid values:

        • RocketMQ 4.x: ApsaraMQ for RocketMQ 4.x.

        • RocketMQ 5.x: ApsaraMQ for RocketMQ 5.x.

        RocketMQ 5.x

        Instance

        The ApsaraMQ for RocketMQ instance in which the messages that you want to route are produced.

        rmq-cn-****

        Topic

        The topic in the ApsaraMQ for RoketMQ instance in which the messages that you want to route are produced.

        topic

        Tag

        The tag that is used to filter messages in the ApsaraMQ for RocketMQ instance.

        test_tag

        Group ID

        The name of the consumer group on ApsaraMQ for RocketMQ instance.

        • Quickly Create: The system automatically creates a consumer group named in the GID_EVENTBRIDGE_xxx format. We recommend that you select this value.

        • Use Existing Group: Select the ID of an existing group that is not in use. If you select an existing group that is in use, the publishing and subscription of existing messages are affected.

        Quickly Create

        Consumer Offset

        • Latest Offset: Messages are consumed from the latest offset.

        • Earliest Offset: Messages are consumed from the earliest offset.

        • Timestamp: Messages are consumed from the specified timestamp.

        Latest Offset

        Consumed At

        The time from which messages are consumed. This parameter is required only if you set the Consumer Offset parameter to Timestamp.

        2024-06-18 15:28:29

        Data Format (Body)

        The data format feature is used to encode binary data delivered from the source into a specific data format. Multiple data formats are supported. If you do not have special requirements on encoding, specify JSON as the value.

        • JSON: Binary data is encoded into JSON-formatted data based on UTF-8 encoding and then put into the payload. This is the default value.

        • Text: Binary data is encoded into strings based on UTF-8 encoding and then put into the payload.

        • Binary: Binary data is encoded into strings based on Base64 encoding and then put into the payload.

        Json

        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 you want to invoke the function. The system sends the aggregated messages to Function Compute at the specified time interval. Valid values: 0 to 15. Unit: seconds. The value 0 indicates that messages are immediately sent after aggregation.

        3

      2. In the Filtering step, define a data pattern to filter data. For more information, see Event patterns.

      3. 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.

      4. 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

        • Data Extraction

        • Fixed Value

        Data Extraction

        $.data.key

        Message Body

        • Complete Data

        • Data Extraction

        • Fixed Value

        • Template

        Data Extraction

        $.data.body

        MessageId

        • Not Specified

        • Data Extraction

        • Fixed Value

        • Template

        Data Extraction

        $.data.props.messageId

        Custom Property

        • Not Specified

        • Data Extraction

        • Template

        Data Extraction

        $.data.props
    • Task Property

      Configure the retry policy that is used when events fail to be pushed and the method that is used to handle faults. For more information, see Retry policies and dead-letter queues.

  4. Click Save. On the Tasks page, find the task that you created. When the status in the Status column changes from Starting to Running, the task is created.

Other operations

On the Tasks page, find the task that you want to manage and perform other operations in the Actions column.

  • View the task details: Click Details in the Actions column. On the Task Details page, view the basic information, properties, and monitoring metrics of the task.

  • Modify the task configurations: Click Edit in the Actions column. In the Edit Task panel, modify the details and properties of the task.

  • 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.