This topic describes how to manage topics in the Simple Message Queue (SMQ, formerly MNS) console.
Prerequisites
SMQ is activated and Resource Access Management (RAM) users are authorized to access SMQ. For more information, see Activate SMQ and authorize RAM users to access SMQ.
Create
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, set the following parameters, and then click OK.
Name: the name of the topic.
Maximum Message Length: the maximum length of the message that is sent to the topic.
Enable Logging Feature: specifies whether to enable the logging feature. If this feature is enabled, SMQ automatically pushes the operation logs of this topic to the specified Logstore. You can then view the message trace, delay, and other information from the logs. For more information, see Log management.
The Topic Details page of the topic appears.
Edit
On the Topics page, find the topic that you want to edit, and click Edit in the Actions column.
In the Edit Parameter of Topic panel, modify the topic settings, and then click OK.
You can view the modified topic settings in the Basic Information section of the Topic Details page.
Search by name
In the search box on the Topics page, enter the prefix of a topic name, such as test, and then click the icon.
All the topics whose names are prefixed by test appear on the page.
Details
On the Topics page, find the topic that you want to view, and click Details in the Actions column.
On the Topic Details page, view the details of the topic.
Endpoints
On the Topics page, find the topic that you want to manage, and click Details in the Actions column.
In the Endpoint section of the Topic Details page, view the endpoints of Internet Access and Internal Access.
NoteYou can send HTTP or HTTPS requests to access the endpoints.
Cloud Monitor
On the Topics page, find the topic that you want to view, and choose in the Actions column.
In the Cloud Monitor section of the Topic Details page, view the monitoring metrics of the topic.
NoteFor more information about alert rules, see Create an alert rule.
Delete
On the Topics page, find the topic that you want to delete, and choose in the Actions column.
In the Note message, read the message, and then click OK.
The topic is displayed as deleted on the Topics page.
WarningA deleted topic cannot be restored.
Create
Log on to the SMQ console.
In the top navigation bar, select a region.
In the left navigation bar, choose
.On the Subscriptions page, click Create Subscription.
On the Create Subscription page, set the following parameters, and then click OK.
Topic Name: Enter a topic name.
Subscription Name: Enter a subscription name. The name can contain a maximum of 255 characters that consist of letters, digits, and hyphens (-). The name must start with a letter.
Subscription: Select a subscription type. The default value is HTTP. For more information about subscription types, see Subscription type.
Receiver Endpoint: the accepter address of a subscription type.
(Optional) Message Filtering Tag: Filter messages by the set tag.
Retry Policy: the retry policy that is applied if an error occurs during message delivery from an SMQ topic to the receiver.
The retry policy parameter can be set to one of the following values:
Backoff Retry: Retry 3 times. The retry interval is a random value between 10 and 20 seconds.
Exponential Decay Retry: Retry 176 times within one day at the following retry intervals that are measured in seconds: 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 512...512 (167 retry intervals of 512 seconds in total).
Message Format: the format of the message that is pushed to the receiver.
SIMPLIFIED: The message body is a message that is published by a user. It does not contain attribute information. Example of message body:
{1:"a", 2:"b"}
JSON: The message is in JSON format and contains the message body and message attributes. Example of message body:
{ "TopicOwner":"TopicOwner", "TopicName":"TopicName", "Subscriber":"Subscriber", "SubscriptionName":"SubscriptionName", "MessageId":"6CC4D900CA59A2CD-1-15180534A8F-20000****", "Message":"xxxxx", "MessageMD5":"F1E92841751D795AB325861034B5****", "MessageTag":"important", "PublishTime":"1449556920975" }
XML: The message is in XML format and contains the message body and message attributes. Example of message body:
<?xml version="1.0" encoding="utf-8"?> <Notification xlmns="http://mns.aliyuncs.com/doc/v1/"> <TopicOwner>TopicOwner</TopicOwner> <TopicName>TopicName</TopicName> <Subscriber>Subscriber</Subscriber> <SubscriptionName>SubscriptionName</SubscriptionName> <MessageId>6CC4D900CA59A2CD-1-15180534A8F-20000****</MessageId> <Message>{1:"a", 2:"b"}</Message> <MessageMD5>F1E92841751D795AB325861034B5****</MessageMD5> <MessageTag>important</MessageTag> <PublishTime>1449556920975</MessagePublishTime> </Notification>
After the subscription is created, it is displayed on the Subscriptions page.
Edit a subscription
On the Subscriptions page, find the subscription that is created, and click Edit in the Actions column.
In the Edit Parameter of Subscription panel, modify the retry policy, and then click OK.
Subscription search
In the search box of the Subscriptions page, enter the prefix of the subscription name, such as test, and then click the icon.
All the subscriptions whose names are prefixed by test appear on the page.
Delete
On the Subscriptions page, find the subscription that you want to delete, and click Delete in the Actions column.
In the Note message, read the message and then click OK.
After the subscription is deleted, it is not displayed on the Subscriptions page.
Publish
On the Topics page, find the topic that you want to publish, 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.
Message Content: the body of the message to be published.
Message Tag: The tag is used to filter messages. This parameter is optional.
Subscription Type: the subscription type of the message that you want to push to the topic. For more information, see Subscription type.
The "The message is sent" message appears on the page.