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

Procedure

  1. Log on to the EventBridge console.
  2. In the left-side navigation pane, choose Event-driven Operations > Event Sources.
  3. In the top navigation bar, select a region.
  4. On the Event Sources page, click the Custom Event Sources tab. On the Custom Event Sources tab, click Add Event Source.
  5. In the Add Custom Event Source panel, enter a name in the Name field and a description in the Description field, select Message Service (MNS) from the Event Provider drop-down list, set the following parameters, and then click OK:
    • Queue Name: Select the created queue.
    • Custom Event Buses: Select the created custom event bus, or click Create Custom Event Bus to associate the custom event source with a new custom event bus.

Sample event

{
    "id":"bffb9722-9c48-407b-9895-b038f78f****",
    "source":"acs:mns",
    "specversion":"1.0",
    "type":"mns:Queue:SendMessage",
    "datacontenttype":"application/json; charset=utf-8",
    "subject":"acs:mns:cn-hangzhou:123456789098****:queues/zeus",
    "time":"2021-04-08T06:28:17.093Z",
    "aliyunpublishtime":"2021-04-08T06:30:31.367Z",
    "aliyuneventbusname":"mybus",
    "data":{
        "requestId":"606EA3074344430D4C81****",
        "messageId":"C6DB60D1574661357FA227277445****",
        "messageBody":"TEST"
    }
}

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

The following table describes the fields in the data parameter.

Field Type Example Description
requestId String 606EA3074344430D4C81**** The ID of the request. The ID of each request is unique.
messageId String C6DB60D1574661357FA227277445**** The ID of the message. The ID of each message is unique.
messageBody String TEST The content of the message.