All Products
Search
Document Center

Simple Message Queue (formerly MNS):Get started with queue-based messaging

最終更新日:Sep 02, 2024

This topic describes how to get started with queue-based messaging in the Simple Message Queue (formerly MNS) console.

Prerequisites

SMQ is activated, and a RAM user is authorized to access SMQ. For more information, see Activate SMQ and authorize RAM users to access SMQ.

Create an SMQ queue

  1. Log on to the SMQ console.

  2. In the left-side navigation pane, click Queues.

  3. In the top navigation bar, select a region.

  4. On the Queues page, click Create Queue.

  5. In the Create Queue panel, set the following parameters and click OK.

    • Name: the name of the queue.

    • Maximum Message Length: the maximum body 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.

    • Visibility Timeout Period: the duration for which a message stays in the Inactive state after the message is received from the queue.

    • 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.

    • Scheduled Period: the period after which all messages sent to the queue are consumed.

    • Enable Logging Feature: specifies whether to enable the logging feature.

    On the Queues page, check whether the queue is created.

Send a message

  1. On the Queues page, find the queue and choose More > Send Messages in the Action column.

  2. In the Send Message section of the Quick Experience page, set the Message Content and Scheduled Period parameters, and then click Send Message.

    "The message is sent" appears on the page.

Receive a message

  1. On the Queues page, find the queue and choose More > Send Messages in the Action column.

  2. Optional. In the Receive Message section of the Quick Experience page, click Edit Parameters of Receiving Messages. In the Edit Parameters of Receiving Messages panel, set the Receive Times and Polling Period parameters, and then click OK.

  3. In the Receive Message section of the Quick Experience page, click Receive Message.

    A list of messages appears in the Receive Message section.

  4. Optional. Find a message in the message list and click Details in the Actions column. In the Message Details dialog box, view the message content and other information.

Delete a queue

  1. On the Queues page, find the queue that you want to delete and choose More > Delete in the Actions column.

  2. In the Note message, read the note and click OK.

    The queue is deleted from the Queues page.

    Warning
    • Once a queue is deleted, data cannot be recovered.

    • Before you delete a queue, stop sending API requests to the queue. Otherwise, the API requests still incur fees.