All Products
Search
Document Center

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

Last Updated:Mar 11, 2026

EventBridge polls messages from an ApsaraMQ for RocketMQ topic, converts them into CloudEvents, and delivers them to a custom event bus for rule-based routing. Once configured, you can analyze events, view event traces, and forward data to downstream targets.

Limits

  • Each event source requires a dedicated consumer group. Do not reuse a consumer group that serves existing production workloads. Assign a unique group ID to every event source.

  • Both RocketMQ 4.x and RocketMQ 5.x instances are supported. Select the version that matches your instance.

Prerequisites

Before you begin, make sure that you have:

Add a RocketMQ event source

  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 target event bus.

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

  6. Click Add Event Source.

  7. In the Add Custom Event Source panel, configure the following parameters and click OK.

    ParameterRequiredDescription
    NameYesEnter a name for the event source.
    DescriptionYesEnter a description.
    Event ProviderYesSelect ApsaraMQ for RocketMQ.
    RegionYesSelect the region where your ApsaraMQ for RocketMQ instance resides.
    VersionYesSelect the instance version: RocketMQ 4.x or RocketMQ 5.x.
    InstanceYesSelect the ApsaraMQ for RocketMQ instance.
    TopicYesSelect the topic on the instance.
    TagNoEnter a tag to filter messages.
    Group IDYesSelect the consumer group ID. A group corresponds to a type of business message. Use a dedicated group that is not shared with other applications or event sources.
    Consumer OffsetYesSelect the offset from which to start consuming messages. Default: Latest Offset.

Verify the integration

After you create the event source, publish a test message to the RocketMQ topic and check the event trace in the EventBridge console. If the configuration is correct, the message appears in the event bus as a CloudEvents-formatted event.

Sample event

After the event source is created, messages published to the RocketMQ topic are delivered to the event bus as CloudEvents in the following format:

{
    "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 CloudEvents envelope fields (id, source, specversion, type, datacontenttype, subject, time), see Event overview.

Data field reference

The data object contains the following fields.

FieldTypeExampleDescription
topicStringTopicNameThe RocketMQ topic name.
systemPropertiesMap--System-level message properties. See the fields below.
systemProperties.MIN_OFFSETInt0The earliest offset in the queue.
systemProperties.TRACE_ONBooleantrueWhether a message trace exists. Valid values: true, false.
systemProperties.MAX_OFFSETInt8The latest offset in the queue.
systemProperties.MSG_REGIONStringcn-hangzhouThe region from which the message was sent.
systemProperties.KEYSStringsystemProperties.KEYSKeys used to filter the message.
systemProperties.CONSUME_START_TIMELong1628577790396The start time of message consumption, in milliseconds.
systemProperties.UNIQ_KEYStringAC14C305069E1B28CDFA3181CDA2****The unique message identifier.
systemProperties.TAGSStringsystemProperties.TAGSTags used to filter the message.
systemProperties.INSTANCE_IDStringMQ_INST_123456789098****_BXhFHryiThe ApsaraMQ for RocketMQ instance ID.
userPropertiesMapNoneCustom user-defined properties attached to the message.
bodyStringTESTThe message body.