This topic describes how to configure Simple Message Queue (formerly MNS) (SMQ) as the source 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 Activate SMQ and authorize RAM users to access SMQ.
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.
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 step, set the Data Provider parameter to SMQ and follow the on-screen instructions to configure other parameters. Then, click Next Step. The following table describes the parameters.
Parameter
Description
Example
Queue Name
The SMQ queue that you created.
test-queue
Base64 Decoding
Specifies whether to enable Base64 decoding. After you enable Base64 decoding, your data in SMQ is decoded in the Base64 format before the data is delivered to the destination service.
test
Messages
The maximum number of messages that can be sent in each function invocation. Requests are sent only when the number of messages in the backlog reaches the specified value. Valid values: 1 to 10000.
100
Interval (Unit: Seconds)
The time interval at which you want to invoke the function. The system sends the aggregated messages to Function Compute when the specified interval is reached. Valid values: 0 to 15. Unit: seconds. The value 0 specifies that messages are sent immediately after aggregation.
3
In the Filtering, Transformation, and Sink steps, configure the event filtering method, event transformation rule, and event target. For information about event transformation configurations, see Use Function Compute to perform message cleansing.
Task Property
Specify 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.
An event stream requires 30 to 60 seconds to be enabled. You can view the progress in the Status column of the event stream on the Event Streams page.
Sample event
{
"specversion":"1.0",
"id":"bffb9722-9c48-407b-9895-b038f78f****",
"source":"acs:mns",
"type":"mns:Queue:SendMessage",
"subject":"acs:mns:cn-hangzhou:123456789098****:queues/zeus",
"datacontenttype":"application/json; charset=utf-8",
"time":"2021-04-08T06:28:17.093Z",
"aliyunpublishtime":"2021-04-08T06:30:31.367Z",
"aliyuneventbusname":"mybus",
"data":{
"requestId":"606EA3074344430D4C81****",
"messageId":"C6DB60D1574661357FA227277445****",
"messageBody":"TEST"
}
}
For information about the parameters defined in the CloudEvents specification, see Overview.
The following table describes the parameters contained in data.
Parameter | Required | Example | Description |
requestId | String | 606EA3074344430D4C81**** | The request ID. The ID of each request is unique. |
messageId | String | C6DB60D1574661357FA227277445**** | The message ID. The ID of each message is unique. |
messageBody | String | TEST | The message body. |