This topic describes how to create a custom event source of the Message Queue for Apache RocketMQ type in the EventBridge 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 Queue for Apache RocketMQ from the Event Provider drop-down list, set the following parameters, and then click OK:
    • Region: Select the region where the created Message Queue for Apache RocketMQ instance resides.
    • Instance: Select the created Message Queue for Apache RocketMQ instance.
    • Topic: Select the created topic.
    • Optional:Tag: Enter a tag for filtering messages.
    • Group ID: Select the created group.
      Note A group corresponds to a type of business message. Therefore, when you create a custom event source of the Message Queue for Apache RocketMQ type, make sure that you do not use a group ID used for existing business.
    • Consumer Offset: Select a consumer offset. By default, this parameter is set to Latest Offset.
    • 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":"94ebc15f-f0db-4bbe-acce-56fb72fb****",
    "source":"acs:mq",
    "specversion":"1.0",
    "type":"mq:Topic:SendMessage",
    "datacontenttype":"application/json; charset=utf-8",
    "subject":"acs:mq:cn-hangzhou:123456789098****:MQ_INST_123456789098****_BXhFHryi%TopicName",
    "time":"2021-04-08T06:01:20.766Z",
    "aliyunpublishtime":"2021-04-08T06:01:20.725Z",
    "aliyuneventbusname":"BusName",
    "data":{
        "topic":"TopicName",
        "systemProperties":{
            "MIN_OFFSET":"0",
            "TRACE_ON":"true",
            "MAX_OFFSET":"8",
            "MSG_REGION":"cn-hangzhou",
            "KEYS":"systemProperties.KEYS",
            "CONSUME_START_TIME":1628577790396,
            "UNIQ_KEY":"AC14C305069E1B28CDFA3181CDA2****",
            "TAGS":"systemProperties.TAGS",
            "INSTANCE_ID":"MQ_INST_123456789098****_BXhFHryi"
        },
        "userProperties":{
        },
        "body":"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
topic String TopicName The name of the topic.
systemProperties Map The system properties.
MIN_OFFSET Int 0 The minimum offset.
TRACE_ON Boolean true Indicates whether a message trace exists. Valid values:
  • true: A message trace exists.
  • false: No message trace exists.
MAX_OFFSET Int 8 The maximum offset.
MSG_REGION String cn-hangzhou The region where the message was sent.
KEYS String systemProperties.KEYS The keys for filtering.
CONSUME_START_TIME Long 1628577790396 The start time of consumption. Unit: milliseconds.
UNIQ_KEY String AC14C305069E1B28CDFA3181CDA2**** The unique key of the message.
TAGS String systemProperties.TAGS The tags for filtering.
INSTANCE_ID String MQ_INST_123456789098****_BXhFHryi The ID of the instance.
userProperties Map N/A The user properties.
body String TEST The content of the message.