This topic describes how to configure Simple Message Queue (formerly MNS) (SMQ) as the sink of an event stream in the EventBridge console.
Prerequisites
EventBridge is activated and the required permissions are granted to a Resource Access Management (RAM) user. For more information, see Activate EventBridge and grant permissions to a RAM user.
An SMQ queue is created. For more information, see Create a queue.
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 page, configure the Task Name and Description parameters and follow the on-screen instructions to configure other parameters. Then, click Save. The following section describes the parameters:
Task Creation
In the Source, Filtering, and Transformation steps, specify the event source, filtering method, and transformation rule. Then, click Next Step. For information about the configurations of event transformation, see Use Function Compute to perform message cleansing.
In the Sink step, set the Service Type parameter to SMQ and follow the on-screen instructions to configure other parameters. The following table describes the parameters.
Parameter
Description
Example
Queue Name
The SMQ queue that you created.
test
Enable Base64 Encoding
Specify whether to enable Base64 encoding. If you disable this feature, the message that you receive contains garbled characters.
Yes
Message Body
The method that you want to use to transform events. For more information, see Event transformation.
Complete Event
Task Property
Configure the retry policy and dead-letter queue for the event stream. For more information, see Retry policies and dead-letter queues.
Go back to the Event Streams page and find the event stream that you created. Then, click Enable in the Actions column.
Enabling an event stream requires 30 to 60 seconds to complete. You can view the progress in the Status column of the event stream on the Event Streams page.
Verify the result
You can check whether events are received in the SMQ console.
Log on to the SMQ console. In the left-side navigation pane, click Queues.
In the top navigation bar, select a region.
On the Queues page, find the queue to which you routed the events and choose in the Actions column.
In the Receive Message section of the Quick Experience page, click Receive Message.
The following sample code provides an example of received events:
{ "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****" }