All Products
Search
Document Center

EventBridge:Route messages between ApsaraMQ for RocketMQ instances

Last Updated:Mar 11, 2026

EventBridge event streams route messages from one ApsaraMQ for RocketMQ instance to another without an event bus. Use event streams to replicate messages across regions, synchronize data between environments, or consolidate messages from multiple instances.

How it works

An event stream connects a source RocketMQ instance to a destination RocketMQ instance through a real-time pipeline:

  1. EventBridge consumes messages from a topic on the source instance.

  2. (Optional) Filtering rules select which messages to forward.

  3. EventBridge extracts the message body, decodes the Base64-encoded binary data, and delivers it to the destination instance.

  4. The message arrives at the specified topic on the destination instance with the original body, key, tag, and custom properties preserved.

Important

Create the event stream in the region of the destination instance. For example, to route messages from China (Beijing) to China (Hangzhou), create the event stream in China (Hangzhou).

Prerequisites

Before you begin, make sure that you have:

  • An activated EventBridge service with the required permissions granted to a Resource Access Management (RAM) user. For more information, see Activate EventBridge and grant permissions to a RAM user

  • At least two ApsaraMQ for RocketMQ instances in the Running state. For more information, see Create an instance

  • A dedicated consumer group on the source instance for the event stream. Do not reuse an existing consumer group because this may disrupt message delivery

Create the event stream

  1. Log on to the EventBridge console.

  2. In the top navigation bar, select the region of the destination RocketMQ instance.

  3. In the left-side navigation pane, click Event Streams.

  4. On the Event Streams page, click Create Event Stream.

  5. Specify the Task Name and Description, then configure the source, filtering, and sink settings as described in the following sections.

Configure the source

In the Source step, set Data Provider to ApsaraMQ for RocketMQ and configure the following parameters, then click Next Step.

ParameterDescriptionExample
RegionRegion of the source RocketMQ instanceChina (Hangzhou)
VersionVersion of the source RocketMQ instanceRocketMQ 4.x
InstanceSource instance that produces the messages to routeMQ_INST_115964845466\*\*\*\*_ByBehioo
TopicTopic on the source instance that contains the messagestopic
TagTag for filtering messages on the source instancetest
Group IDDedicated consumer group on the source instance. Use a separate group for the event stream to avoid disrupting existing consumersGID_http_1
Consumer OffsetStarting offset for consuming messagesLatest Offset
Data FormatEncoding format for binary data from the source. Set to Binary for message routingBinary
Batch PushAggregates multiple events before delivery. A batch is sent when either the Messages count or Interval is reached, whichever comes firstEnable
MessagesMaximum number of messages per batch. Valid values: 1 to 10000100
Interval (Unit: Seconds)Maximum wait time before a batch is sent. Valid values: 0 to 15. A value of 0 sends messages immediately3

Configure filtering

In the Filtering step, specify event filtering rules if needed, then click Next Step.

Note

Specific content in the message value cannot be used to filter events based on the configurations in this example. For standard message routing, no filtering is required. The Transformation step is also not needed for this use case. Skip it and proceed to the sink configuration.

Configure the sink

In the Sink step, set Service Type to ApsaraMQ for RocketMQ and configure the following parameters, then click Save.

ParameterDescriptionExample
VersionVersion of the destination RocketMQ instanceRocketMQ 4.x
Instance IDID of the destination RocketMQ instancetest
TopicTopic on the destination instance to receive the routed messagestest
Message BodyJSONPath expression to extract and Base64-decode the message body from the eventBinary Extraction: $.data.body
Custom PropertyTemplate-based extraction that maps source message attributes to the destination. Select Template and use the variables and template shown in the example to forward all message attributesVariables: {"userProperties":"$.data.userProperties", "msgId":"$.data.systemProperties.UNIQ_KEY"} Template: {"EB_SYS_EMBED_OBJECT":"${userProperties}", "UNIQ_KEY":"${msgId}"}
Message KeyJSONPath expression to extract the message key from the eventPartial Event: $.data.systemProperties.KEYS
Message TagJSONPath expression to extract the message tag from the eventPartial Event: $.data.systemProperties.TAGS
Note

The Custom Property configuration above forwards all user-defined message attributes and the original message ID. This preserves traceability across instances.

Configure retry and dead-letter settings

Under Task Property, specify the retry policy and dead-letter queue for the event stream. The retry policy determines how EventBridge handles delivery failures. The dead-letter queue stores messages that cannot be delivered after all retries are exhausted, so you can investigate and reprocess them later.

For more information, see Retry policies and dead-letter queues.

Enable the event stream

  1. Go back to the Event Streams page, find the event stream, and click Enable in the Actions column.

  2. In the Note dialog, click OK.

The event stream takes 30 to 60 seconds to start. Monitor the Status column on the Event Streams page until the stream is running.

Verify the event stream

Send a test message from the source instance and confirm it arrives at the destination.

Send a test message

  1. Log on to the ApsaraMQ for RocketMQ console.

  2. In the top navigation bar, select the region of the source RocketMQ instance.

  3. In the left-side navigation pane, click Instances.

  4. Find the source instance, then click Details in the Actions column.

    View instance details

  5. In the left-side navigation pane, click Topics.

  6. Click the name of the source topic configured in the event stream.

  7. In the upper-right corner of the Topic Details page, click Quick Start.

  8. In the Start Message Production and Consumption panel, set Sending Method to Console, fill in the Body, Message Key, and Message Tag fields, then click OK. After the message is sent, the console displays The message is sent. along with the message ID. Note this ID for verification.

    Send a test message

Check the destination

  1. Go back to the Instances page.

  2. Find the destination instance, then click Details in the Actions column.

  3. In the left-side navigation pane, click Topics.

  4. Click the name of the destination topic configured in the event stream.

  5. On the Topic Details page, click the Message Query tab.

  6. Set the Query Method and Time Range, then click Search.

    Query messages on the destination

  7. Confirm that the message ID, tag, and key match those of the message sent from the source instance.

Related information