This guide walks you through the queue-based messaging lifecycle in the Simple Message Queue (formerly MNS) console: create a queue, send a message, receive it, and delete the queue.
Prerequisites
Before you begin, make sure that you have activated Simple Message Queue (formerly MNS) and granted the required permissions.
Create a queue
Log on to the SMQ console.
In the left-side navigation pane, choose Queue Model > Queues.
In the top navigation bar, select a region.
On the Queues page, click Create Queue.
In the Create Queue panel, configure the following parameters and click OK.
Name: the name of the queue.
Maximum Message Length: the maximum length of the message that is sent to the queue.
Long Polling Period: the maximum duration for which long polling requests are held after the ReceiveMessage operation is called. The value 0 indicates that long polling is disabled.
Visibility Timeout Period: the duration for which a message stays in the Inactive state after the message is received from the queue. For more information, see Message visibility.
Message Retention Period: the maximum duration for which a message exists in the queue. After the specified retention period, the message is deleted regardless of whether the message is received.
Message Delay Period: the period after which all messages sent to the queue are consumed.
Enable Logging Feature: specifies whether to enable the logging feature. If this feature is enabled, SMQ automatically pushes the operation logs of this queue 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 created queue appears on the Queues page.
Send a message
On the Queues page, find the target queue, and in the Action column, choose .
On the Quick Experience For Sending And Receiving Messages page, go to the Send Message section. Enter the Message Content and Message Delay Period, and then click Send Message.
A "Message sent successfully" message appears.
Receive a message
After a message is received, it enters the Inactive state for the duration specified by the Visibility Timeout Period. For more information about message states, see Message visibility.
On the Queues page, find the target queue, and in the Action column, choose .
Optional: On the Quick Experience For Sending And Receiving Messages page, go to the Receive Message section and click Edit Parameters of Receiving Messages. In the Edit Parameters of Receiving Messages panel, configure the Receive Times and Polling Period parameters, and then click OK.
In the Receive Message section of the Quick Experience For Sending And Receiving Messages page, click Receive Message.
The list of messages in the queue is displayed in the Receive Message section.
Optional: In the message list, find the target message and click Details in the Actions column. In the Message Details dialog box, view information such as the message body.
Delete a queue
After a queue is deleted, its data cannot be recovered. Before you delete a queue, stop sending API requests to it. Otherwise, you will still be charged for the API requests.
On the Queues page, find the target queue, and in the Actions column, choose .
In the Notice dialog box, read the notice and then click Confirm.
The queue is deleted and no longer appears on the Queues page.