All Products
Search
Document Center

EventBridge:Route events to ApsaraMQ for RabbitMQ

Last Updated:Nov 30, 2023

This topic describes how to create an event stream whose event target is ApsaraMQ for RabbitMQ in the EventBridge console.

Prerequisites

Create an event stream

  1. Log on to the EventBridge console. In the left-side navigation pane, click Event Streams.

  2. In the top navigation bar, select a region and click Create Event Stream.

  3. On the Create Event Stream 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

      1. In the Source, Filtering, and Transformation steps, configure the event source, event filtering method, and event transformation rule. Then, click Next Step. For information about event transformation configurations, see Use Function Compute to perform message cleansing.

      2. In the Sink step, set the Service Type parameter to Message Queue for RabbitMQ and follow the on-screen instructions to configure other parameters. The following table describes the parameters.

        Parameter

        Description

        Example

        Instance ID

        Select the ApsaraMQ for RabbitMQ instance that you created.

        amqp-cn-zvp2pny6****

        vhost

        Select 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 event content to the event target. This parameter is required only if you set the Destination Type parameter to Exchange.

        Partial Event

        $.data.key

        Message Body

        EventBridge extracts data from an event by using JSONPath and routes the specified event content to the event target.

        Partial Event

        $.data.body

        MessageId

        EventBridge extracts data from an event by using JSONPath and routes the specified event content to the event target.

        Partial Event

        $.data.props.messageId

        Custom Property

        EventBridge extracts data from an event by using JSONPath and routes the specified event content to the event target.

        Partial Event

        $.data.props
    • Task Property

      Configure the retry policy and dead-letter queue for the event stream. For more information, see Retry policies and dead-letter queues.

  4. Go back to the Event Streams page and find the event stream that you created. Then, click Enable in the Actions column.

    Enabling an event stream requires 30 to 60 seconds to complete. You can view the progress in the Status column of the event stream on the Event Streams page.

Verify the result

  1. Log on to the ApsaraMQ for RabbitMQ console. In the Resource Distribution section of the Overview page, select the region where your ApsaraMQ for RabbitMQ instance resides.

  2. On the Instances page, click the name of the instance that you want to manage.

  3. In the Basic Information section of the Instance Details page, click the Message Query tab.

  4. On the Message Query tab, select Query by Queue and configure the Queue and Time Range parameters. Then, click Query.

    查询Rabbit消息