Add SMQ as a service type for an event stream in the EventBridge console to route events to a message queue.
Prerequisites
Create an event stream
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.
-
On the Create Event Stream panel, set the Task Name and Description, configure the following parameters, and click Save.
-
Task creation
-
In the Source, Filtering, and Transformation steps, configure event filtering and transformation rules, and click Next. For more information about how to configure event transformation, see Use Function Compute to perform message data cleansing.
-
In the Sink step, set Service Type to Simple Message Queue (formerly MNS) and configure the following parameters.
Parameter
Description
Example
Queue Name
Select an existing SMQ queue.
test
Enable Base64 Encoding
Recommended. If disabled, received messages may contain garbled characters.
Yes
Message Body
The part of the event to use as the message body. For more information, see Event content transformation.
complete event
-
-
Task properties
Configure the retry policy and dead-letter queue for the event stream. For more information, see Retries and dead-letter queues.
-
-
Return to the Event Streams page. Find your event stream and click Enable in the Actions column.
The event stream takes 30 to 60 seconds to start. View the startup progress in the Status column on the Event Streams page.
Verify the results
Verify that events are received in the SMQ console.
Log on to the SMQ console. In the left-side navigation pane, choose Queue Model > Queues.
In the top navigation bar, select a region.
-
On the Queues page, find the target queue, and in the Actions column, choose .
-
On the Quick Experience for Sending and Receiving Messages page, in the Receive Message section, click Receive Message.
Sample of a received message:
{ "data":{ "props":{ "firstTopic":"topci12****", "secondTopic":"", "clientId":"GID_MQTT_CONSOLE@@@lmqhb1share01vpc165759566****" }, "body":"Hello World" }, "id":"AC11C08E76C67E7740853B0F604D****", "source":"acs:mqtt", "specversion":"1.0", "type":"mqtt:Topic:SendMessage", "datacontenttype":"application/json; charset\u003dutf-8", "time":"2022-07-12T03:14:23.447Z", "subject":"acs:mq:cn-qingdao:182572506381****:topic/mqtt-cn-2r42rdr****/topci12****", "aliyunaccountid":"182572506381****" }