All Products
Search
Document Center

EventBridge:ApsaraMQ for RabbitMQ

Last Updated:Nov 30, 2023

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

Prerequisites

Procedure

  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. In the Create Event Stream panel, 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 step, set the Data Provider parameter to Message Queue 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 where the source ApsaraMQ for RabbitMQ instance resides.

        China (Hangzhou)

        Message Queue for RabbitMQ Instance

        The source ApsaraMQ for RabbitMQ instance.

        amqp-cn-7pp2mwbc****

        Vhost

        The vhost of the source instance.

        test

        Queue

        The queue in which the messages to be routed are stored.

        test

        Batch Push

        The batch push feature helps you aggregate multiple events at a time. This feature is triggered if the condition that is specified by the Messages parameter or the Batch Push Interval (Unit: Seconds) parameter is met.

        For example, if you set the Messages parameter to 100 and the Interval (Unit: Seconds) parameter to 15, the push is executed when the number of messages reaches 100 even if only 10 seconds are elapsed.

        Enable

        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

        Batch Push 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 indicates that messages are immediately sent after aggregation.

        3

      2. In the Filtering, Transformation, and Sink steps, configure the event filtering method, event transformation rule, and event target. For information about event transformation configurations, see Use Function Compute to perform message cleansing.

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

Sample event

{
    "specversion":"1.0",
    "id":"8b09e19b-8cbd-4c46-ab77-9cc39c44****",
    "source":"housekeeping.rabbitmq",
    "type":"amqp:Queue:SendMessage",
    "subject":"acs:amqp:cn-hangzhou:143998900779****:/instances/amqp-cn-zvp2av0m****/vhosts/eb-connect/queues/housekeeping",
    "datacontenttype":"application/json;charset=utf-8",
    "aliyunaccountid":"143998900779****",
    "aliyunoriginalaccountid":"143998900779****",
    "aliyunpublishtime":"2021-08-12T06:56:50.783Z",
    "aliyuneventbusname":"Housekeeping-Connect",
    "time":"2021-08-12T06:56:40.709Z",
    "aliyunregionid":"cn-hangzhou",
    "data":{
        "envelope":{
            "deliveryTag":98,
            "exchange":"amq.direct",
            "redeliver":false,
            "routingKey":"housekeeping"
        },
        "body":{
            "Hello":"EventBridge"
        },
        "props":{
            "contentEncoding":"UTF-8",
            "messageId":"f7622d51-e198-41de-a072-77c1ead7****"
        }
    }
}

For information about the parameters defined in the CloudEvents specification, see Overview.

The following table describes the parameters contained in data.

Parameter

Type

Example

Description

envelope

Map

The envelope information about the message.

deliveryTag

Int

98

The message tag.

exchange

String

amq.direct

The name of the exchange that sent the message.

redeliver

Boolean

false

Indicates whether the message can be re-sent. Valid values:

  • true

  • false

routingKey

String

housekeeping

The rule that is used to route the message.

body

Map

The message body.

Hello

String

EventBridge

The user data.

props

Map

The message attributes.

contentEncoding

String

UTF-8

The format in which the message body is encoded.

messageId

String

f7622d51-e198-41de-a072-77c1ead7****

The message ID. The ID of each message is unique.