This topic describes how to add ApsaraMQ for RocketMQ (Offset Data) as an event provider in an event stream in the EventBridge console.
Prerequisites
Create an ApsaraMQ for RocketMQ 5.x instance or an ApsaraMQ for RocketMQ 4.x instance.
Create a topic for an ApsaraMQ for RocketMQ 5.x instance or a topic for an ApsaraMQ for RocketMQ 4.x instance.
Procedure
Log on to the EventBridge console. In the left-side navigation pane, click Event Streams.
In the top navigation bar, select a region and click Create Event Stream.
In the Create Event Stream panel, set Task Name and Description, configure the following parameters, and then click Save.
Task Creation
In the Source configuration wizard, select Data Provider as ApsaraMQ For RocketMQ (Offset Data), set the following parameters, and then click Next Step.
Parameter
Description
Example
Region
Select the region where the source ApsaraMQ For RocketMQ instance is located.
China (Hangzhou)
Version
The version of the source ApsaraMQ for RocketMQ instance. The following versions are supported:
RocketMQ 4.x
RocketMQ 5.x
RocketMQ 5.x
Instance
Select the source ApsaraMQ For RocketMQ instance that produces messages.
rmq-cn-jte3w5i****
Topic
Select the topic that produces ApsaraMQ For RocketMQ messages.
topic
Messages
The maximum number of messages that can be sent in a batch when a function is called. The request is sent only when the number of accumulated messages reaches the specified value. Valid values: 1 to 10000.
100
Interval (Unit: Seconds)
The time interval at which you want to invoke the function. The system sends the aggregated messages to Function Compute at the specified time interval. Valid values: 0 to 15. Unit: seconds. The value 0 indicates that messages are sent immediately after aggregation.
3
In the Filtering, Transformation, and Sink configuration wizards, set event filtering and transformation rules and event targets.
Task Property
Set the retry policy and dead-letter queue for the event stream.
Return to the Event Streams page, find the created event stream, and click Enable in the Actions column.
After you enable the event stream, a latency of 30 to 60 seconds occurs. You can view the startup progress in the Status column on the Event Streams page.
Example
{
"datacontenttype": "application/json;charset=utf-8",
"aliyunaccountid": "1******6789",
"data": {
"systemProperties": {
"BORN_TIMESTAMP": "1713756930836",
"MSG_REGION": "cn-hangzhou",
"UNIQ_KEY": "123F486466E118B4AAC26EA24F13****",
"TAGS": "tagA"
},
"userProperties": {
"demoPropertyKey": "demoPropertyValue"
},
"msgId": "123F486466E118B4AAC26EA24F13****",
"topic": "test-topic",
"body": {
"number": 100,
"name": "EventBridge"
}
},
"subject": "acs:mq:cn-hangzhou:1******6789:rmq-cn-123456abc%test-topic",
"aliyunoriginalaccountid": "1******6789",
"source": "RocketMQSource",
"type": "mq:Topic:SendMessage",
"aliyunpublishtime": "2024-04-22T03:35:31.315Z",
"specversion": "1.0",
"aliyuneventbusname": "DemoBus",
"id": "123F486466E118B4AAC26EA24F13****",
"time": "2024-04-22T03:35:30.836Z",
"aliyunregionid": "cn-hangzhou",
"aliyunpublishaddr": "172.20.11.11"
}For more information about the parameters defined in the CloudEvents specification, see Event overview.
The following table describes the parameters in the data field.
Parameter | Type | Example | Description |
| Map | The system properties. | |
| String | 1713756930836 | The time when the message was produced. |
| String | cn-hangzhou | The region from which the message is sent. |
| String | AC14C305069E1B28CDFA3181CDA2**** | The unique key of the message. |
| String | tagA | The properties that are used to filter messages. |
| Map | {"demoPropertyKey":"demoPropertyValue" } | The user attributes. |
| String | 123F486466E118B4AAC26EA24F13**** | The globally unique ID of the message. |
| String | test-topic | The name of the topic. |
| String | {"number": 100, "name": "EventBridge"} | The message content. |