All Products
Search
Document Center

EventBridge:Configure Simple Message Queue (formerly MNS) as an event source

Last Updated:Mar 10, 2026

When messages arrive in a Simple Message Queue (formerly MNS) (SMQ) queue, you may need to route them to downstream services such as Function Compute for processing. EventBridge event streams connect an SMQ queue to a target service so that messages are delivered automatically without polling or custom integrations.

Prerequisites

Before you begin, make sure that you have:

Create an event stream with an SMQ source

  1. Log on to the EventBridge console. In the left-side navigation pane, click Event Streams.

  2. In the top navigation bar, select a region and click Create Event Stream.

  3. On the Create Event Stream page, specify the Task Name and Description parameters.

  4. Configure the event source, filtering, transformation, sink, and task properties as described in the following sections. Then click Save.

Source

In the Source step, set Data Provider to SMQ and configure the following parameters. Then click Next Step.

ParameterDescriptionValid valuesExample
Queue NameThe SMQ queue to use as the event source.N/Atest-queue
Base64 DecodingWhether to decode message data from Base64 before delivery to the sink. Enable this if your SMQ messages are Base64-encoded.N/Atest
MessagesThe 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.1 to 10,000100
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. Set to 0 to send messages immediately after aggregation.0 to 153

Filtering, transformation, and sink

In the Filtering, Transformation, and Sink steps, configure the event filtering method, event transformation rule, and event target.

For more information about event transformation, see Use Function Compute to perform message cleansing.

Retry policy and dead-letter queue

Under Task Property, specify the retry policy and dead-letter queue for the event stream.

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

Enable the event stream

  1. Go back to the Event Streams page and find the event stream that you created.

  2. In the Actions column, click Enable.

The event stream takes 30 to 60 seconds to start. Track the progress in the Status column on the Event Streams page.

Sample event

Each message from the SMQ queue is delivered as a CloudEvents 1.0-compliant event. The following example shows the structure of a typical 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 more information about the CloudEvents envelope fields (specversion, id, source, type, subject, time, and others), see Overview.

Data fields

The data object contains the original SMQ message payload:

FieldTypeDescription
requestIdStringA unique identifier for the request that sent the message to the queue.
messageIdStringA unique identifier for the message in the queue.
messageBodyStringThe message body content.

See also