Simple Message Queue (SMQ, formerly MNS) can deliver messages published to a topic to one or more subscribed queues. This decouples publishers from consumers and enables parallel, asynchronous processing -- for example, an order event that triggers both inventory updates and analytics in separate queues.
This guide walks through the console workflow: create a topic, subscribe a queue, and publish a test message.
How it works
A publisher sends a message to a topic.
The topic evaluates its subscriptions and delivers a copy of the message to each subscribed endpoint.
A queue subscribed to the topic receives the message and holds it until a consumer retrieves it.
Prerequisites
Before you begin, make sure that you have:
An Alibaba Cloud account with SMQ activated
A queue created in the SMQ console to use as the subscription endpoint
Step 1: Create a topic
Log on to the SMQ console.
In the left-side navigation pane, choose Topic Model > Topics.
In the top navigation bar, select a region.
On the Topics page, click Create Topic.
In the Create Topic panel, configure the following parameters, and then click OK.
Parameter
Description
Name
The topic name. Use a descriptive name that reflects the message type, such as
order-events.Maximum Message Length
The maximum length of the message body sent to this topic.
Enable Logging Feature
Specifies whether to enable log management for this topic.
After the topic is created, the Topic Details page appears.
Step 2: Subscribe a queue to the topic
A subscription defines where and how topic messages are delivered. In this step, you create a subscription that routes messages to an existing queue.
On the Topics page, find the target topic and click Subscriptions in the Actions column.
In the View Subscriptions to {topic} Topic panel, click Subscriptions.
On the Manage Subscriptions page, click Create Subscription.
In the Create Subscription panel, configure the following parameters, and then click OK.
Parameter
Description
Topic Name
The name of the topic that this subscription belongs to.
Subscription Name
A unique name for the subscription.
Subscription
The endpoint type. Select Queue.
Receiver Endpoint
The target queue. Select an existing queue name.
Message Filtering Tag
(Optional) A tag to filter messages.
Retry Policy
The retry policy for message delivery. Select a retry policy.
Message Format
The format of the message payload pushed to the endpoint.
Step 3: Publish a test message
After the topic and subscription are configured, publish a message to verify the pipeline.
On the Topics page, find the target topic and click Publish Message in the Actions column.
On the Try Publishing Message To Topic page, configure the following parameters, and then click Publish Message.
Parameter
Description
Message Content
The message body to publish.
Message Tag
(Optional) A tag to filter messages.
Subscription Type
Select Queue.