This topic describes how to use EventBridge to route event streams to ApsaraMQ for RocketMQ (Offset Reset) in real time to implement message distribution and consumption management in an event-driven architecture.
Before you start
Activate EventBridge and grant permissions to a Resource Access Management (RAM) user.
Create an ApsaraMQ for RocketMQ 5.x instance or an ApsaraMQ for RocketMQ 4.x instance.
Create a topic on the ApsaraMQ for RocketMQ 5.x instance or a topic on the ApsaraMQ for RocketMQ 4.x instance.
(Optional) Add tags to the ApsaraMQ for RocketMQ 5.x instance or tags to the ApsaraMQ for RocketMQ 4.x instance.
(Optional) Create a group on the ApsaraMQ for RocketMQ 5.x instance or a group on the 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, configure the Task Name and Description parameters. Then, follow the on-screen instructions to configure other parameters.
Task Creation
In the Source, Filtering, and Transformation steps, specify the event source, event filtering rule, and event transformation rule. Then, click Next Step. For more information about event transformation, see Use Function Compute to perform message cleansing.
In the Sink step, select ApsaraMQ for RocketMQ (Offset Reset) from the Service Type drop-down list, configure the following parameters, and then click Save.
Parameter
Description
Example
Instance Type
The version of the ApsaraMQ for RocketMQ instance. Valid values:
RocketMQ 4.x
RocketMQ 5.x
RocketMQ 5.x
InstanceId
The ApsaraMQ for RocketMQ instance to which you want to route messages.
rmq-cn-77845****
Topic
The topic on the ApsaraMQ for RocketMQ instance to which you want to route messages. Valid values:
Partial Event: If you select this value, EventBridge extracts a field value from events by using JSONPath as the destination topic.
Fixed Value: If you select this value, you must enter a topic name in the corresponding field. All events are delivered to this topic.
Template: If you select this value, you must specify custom content in the Variables and Template code editors. EventBridge generates a topic name based on the template.
Partial Event
$.data
Group
The group used to manage offsets on the ApsaraMQ for RocketMQ instance. Valid values:
Partial Event: If you select this value, EventBridge extracts the group name by using JSONPath.
Fixed Value: If you select this value, you must enter a group name in the corresponding field.
Template: If you select this value, you must specify custom content in the Variables and Template code editors. EventBridge generates a group name based on the template.
Partial Event
$.data
ConsumeTimestamp
The timestamp that specifies when messages are consumed. Valid values:
Partial Event: If you select this value, EventBridge extracts an existing timestamp field from events as the consumption time.
Fixed Value: If you select this value, you must enter a consumption timestamp in the corresponding field.
Template: If you select this value, you must specify custom content in the Variable and Template code editors. EventBridge generates a consumption timestamp based on the template.
Partial Event
$.data
Task Property
Specify the retry policy and dead-letter queue for the event stream. For more information, see Retry policies and dead-letter queues.
Verify the result
Log on to the ApsaraMQ for RocketMQ console. In the top navigation bar, select the region where the desired instance resides.
In the left-side navigation pane, click Instances.
On the Instances page, find the desired instance and click Details in the Actions column.
In the left-side navigation pane, click Topics. Then click the name of the desired topic.
On the Topic Details page, click the Message Query tab, configure the Query Method and Time Range parameters, and then click Query.