Get started with queue-based messaging

更新时间:
复制 MD 格式

Create queues, send messages, receive messages, and delete queues in the Simple Message Queue (formerly MNS) console.

Prerequisites

Activate SMQ and authorize RAM users to access SMQ

Create a queue

  1. Log on to the SMQ console.

  2. In the left-side navigation pane, choose Queue Model > 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 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 queue appears on the Queues page.

Send a message

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

  2. On the Quick Experience page, in the Send Message section, enter the Message Content and Message Delay Period, and then click Send Message.

    A success message appears.

Receive a message

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

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

  3. On the Quick Experience page, in the Receive Message section, click Receive Message.

    Messages appear in the Receive Message section.

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

Delete a queue

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

  2. In the Prompt dialog box, review the prompt and click OK.

    The queue is removed from the Queues page.

    Warning
    • You cannot recover data from a deleted queue.

    • Stop all API requests to a queue before deleting it. Otherwise, you will continue to be charged for those requests.