EventBridge can ingest messages from ApsaraMQ for RocketMQ for event analysis, event tracing, and data forwarding. This topic describes how to add an ApsaraMQ for RocketMQ custom event source in the EventBridge console.
Prerequisites
Procedure
- Log on to the EventBridge console.
- In the left-side navigation pane, click Event Buses.
- In the top navigation bar, select a region.
On the Event Buses page, click the name of the event bus that you want to manage.
In the left-side navigation pane, click Event Sources.
On the Event Source page, click Add Event Source.
In the Add Custom Event Source panel, enter a Name and Description. Select ApsaraMQ for RocketMQ from the Event Provider drop-down list. Configure the parameters and click OK.
Region: Select the region where the ApsaraMQ for RocketMQ instance is located.
Version: Select RocketMQ 4.x or RocketMQ 5.x.
Instance: Select the ApsaraMQ for RocketMQ instance.
Topic: Select the topic.
(Optional) Tag: Enter a tag for message filtering.
Group ID: Select the group ID.
NoteA group ID corresponds to a specific type of business message. Ensure that each event source uses a dedicated group ID and does not share a group ID with existing business applications.
Consumer Offset: Select the consumer offset. The default is Latest Offset.
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 Event overview.
The parameters in the data field are described in the following table.
Parameter | Type | Example | Description |
topic | String | TopicName | The topic name. |
systemProperties | Map | System properties. | |
MIN_OFFSET | Int | 0 | The earliest offset. |
TRACE_ON | Boolean | true | Indicates whether a message trace exists. Valid values:
|
MAX_OFFSET | Int | 8 | The latest offset. |
MSG_REGION | String | cn-hangzhou | The region from which the message was sent. |
KEYS | String | systemProperties.KEYS | The keys used for message filtering. |
CONSUME_START_TIME | Long | 1628577790396 | The message consumption start time. Unit: milliseconds. |
UNIQ_KEY | String | AC14C305069E1B28CDFA3181CDA2**** | The unique key of the message. |
TAGS | String | systemProperties.TAGS | The tags used for message filtering. |
INSTANCE_ID | String | MQ_INST_123456789098****_BXhFHryi | The instance ID. |
userProperties | Map | User-defined properties. | |
body | String | TEST | The message body. |