All Products
Search
Document Center

EventBridge:Create a custom event source of the ApsaraMQ for RabbitMQ type

Last Updated:Nov 03, 2023

This topic describes how to create a custom event source of the ApsaraMQ for RabbitMQ type in the EventBridge console.

Before you start

Usage notes

You can create custom event sources of the ApsaraMQ for RabbitMQ type only in the regions where EventBridge is available.

Procedure

  1. Log on to the EventBridge console.
  2. In the left-side navigation pane, click Event Buses.
  3. In the top navigation bar, select a region.
  4. On the Event Buses page, click the name of the event bus that you want to manage.

  5. In the left-side navigation pane, click Event Sources.

  6. On the Event Source page, click Add Event Source.

  7. In the Add Custom Event Source panel, configure the Name and Description parameters, select Message Queue for RabbitMQ from the Event Provider drop-down list, configure the other parameters, and then click OK. The following items describe the parameters:

    • Region: Select the region where the ApsaraMQ for RabbitMQ instance that you created resides.

    • Message Queue for RabbitMQ Instance: Select the ApsaraMQ for RabbitMQ instance that you created.

    • vhost: Select the vhost that you created.

    • Queue: Select the queue that you created.

Sample event

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

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

The following table describes the parameters contained in data.

Parameter

Type

Example

Description

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.

envelope

Map

The information about the message envelope.

deliveryTag

Int

98

The message tag.

exchange

String

None

The name of the exchange that sends the message.

redeliver

Boolean

false

Specifies whether the message can be resent. Valid values:

  • true

  • false

routingKey

String

housekeeping

The routing rule of the message.