ApsaraMQ for RabbitMQ

更新时间:
复制 MD 格式

This topic describes how to add ApsaraMQ for RabbitMQ as an event source for an event stream 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, set Task name and Description, configure the following parameters, and then click Save.

    • Stream configuration

      1. In the Source step, set Data Provider to ApsaraMQ for RabbitMQ, configure the following parameters, and then click Next Step.

        Parameter

        Description

        Example

        Region

        The region of the source ApsaraMQ for RabbitMQ instance.

        China (Hangzhou)

        ApsaraMQ for RabbitMQ Instance

        The source ApsaraMQ for RabbitMQ instance.

        amqp-cn-7pp2mwbc****

        Vhost

        The Vhost of the source instance.

        test

        Queue

        The source queue.

        test

        Batch Push

        This feature aggregates multiple events into a single batch. A push is triggered when the threshold for either Messages or Interval (Unit: Seconds) is met, whichever occurs first.

        For example, if you set Messages per Batch to 100 and the Batch Interval to 15 seconds, the system pushes the batch as soon as the message count reaches 100, even if only 10 seconds have passed.

        Enabled

        Messages

        The maximum number of messages to include in a single batch. A batch is sent when the accumulated message count reaches this value. The value must be an integer from 1 to 10,000.

        100

        Interval (Unit: Seconds)

        The time interval, in seconds, between function invocations. The system aggregates messages and sends them in a batch at this specified interval. The value must be an integer from 0 to 15. A value of 0 indicates that the system delivers events immediately.

        3

      2. In the Filtering, Transformation, and Sink steps, configure the event filter, transformation rules, and sink. For more information about event transformation, see Use Function Compute to perform message cleansing.

    • Reliability settings

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

  4. Return to the Event Streams page. Find the event stream, and in the Actions column, click Enable.

    After you enable the event stream, it takes 30 to 60 seconds to start. You can check the startup progress in the Status column on the Event Streams page.

Event example

{
    "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 an explanation of the parameters defined in the CloudEvents specification, see Overview of events.

The parameters in the data field are described in the following table.

Parameter

Type

Example

Description

envelope

Map

The message envelope.

deliveryTag

Int

98

The delivery tag of the message.

exchange

String

amq.direct

The exchange that sent the message.

redeliver

Boolean

false

Specifies whether the message can be redelivered. Valid values:

  • true: Supported.

  • false: Not supported.

routingKey

String

housekeeping

The routing key of the message.

body

Map

The message body.

Hello

String

EventBridge

The user-defined data.

props

Map

The message properties.

contentEncoding

String

UTF-8

The content encoding of the message body.

messageId

String

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

The unique ID of the message.