MNS allows you to push messages to a specified queue of a topic. This article describes how to push messages to a queue.

Step 1: Create a queue

  1. Log on to the MNS 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 dialog box, 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 whether the message is received or not.
    • Scheduled Period: the period after which all messages sent to the queue are consumed.
    • Enable Logging Feature: specifies whether to enable the logging feature.
    The queue is displayed on the Queues page.

Step 2: Create a topic

  1. Log on to the MNS console.
  2. In the left-side navigation pane, click Topics.
  3. In the top navigation bar, select a region.
  4. On the Topics page, click Create Topic.
  5. In the Create Topic dialog box, set the following parameters and click OK.
    • Name: the name of the topic.
    • Maximum Message Length: the maximum body length of the message that is sent to the topic.
    • Enable Logging Feature: specifies whether to enable the logging feature.
    The Topic Details page appears.

Step 3: Create a subscription

  1. Log on to the MNS console.
  2. In the left-side navigation pane, click Topics.
  3. In the top navigation bar, select a region.
  4. On the Topics page, find the topic for which you want to create a subscription. Click Subscriptions in the Actions column.
  5. On the Manage Subscriptions page, click Create Subscription.
  6. In the Create Subscription dialog box, set the following parameters and click OK.
    • Name: Enter the name of the subscription.
    • Push Type: Select Queue.
    • Receiver Endpoint: Select the queue created in Step 1.
    • Optional:Message Filtering Tag: Enter a tag to filter messages.
    • Retry Policy: Select a retry policy.
    • Message Pushing Format: Select a format for pushed messages.

Step 4: Publish messages

  1. Log on to the MNS console.
  2. In the left-side navigation pane, click Topics.
  3. In the top navigation bar, select a region.
  4. On the Topics page, find the topic to which you want to publish a message. Choose More > Publish Message in the Actions column.
  5. On the Try Publishing Message to Topic page, set the following parameters and click Publish Message.
    • Message Content: Enter the message content.
    • Optional:Message Tag: Enter a tag to filter messages.
    • Subscription Type: Select Queue.

Step 5: Receive messages

  1. Log on to the MNS console.
  2. In the left-side navigation pane, click Queues.
  3. In the top navigation bar, select a region.
  4. On the Queues page, find the queue from which you want to receive a message. Choose More > Send Messages in the Action column.
  5. Optional:In the Receive Message section of the Quick Experience page, click Edit Parameters of Receiving Messages. In the Edit Parameters of Receiving Messages dialog box, specify the Receive Times and Polling Period parameters, and then click OK.
  6. In the Receive Message section of the Quick Experience page, click Receive Message.
    A list of received messages are displayed in the Receive Message section.
  7. Optional:In the message list, find the message that you want to view. Click Details in the Actions column. In the Message Details dialog box, view the message details, such as message content.