All Products
Search
Document Center

Simple Message Queue (formerly MNS):Push messages to a queue

更新時間:Sep 02, 2024

Simple Message Queue (formerly MNS) allows you to push messages to a queue. This topic describes how to push messages to a queue.

Step 1: Create a topic

  1. Log on to the SMQ 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 panel, set the following parameters and 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.

    After the topic is created, the Topic Details page of the topic automatically appears.

Step 2: Create a subscription

  1. Log on to the SMQ 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. In the panel that appears, click Subscriptions.

  6. On the Manage Subscriptions page, click Create Subscription.
  7. In the Create Subscription panel, set the following parameters and click OK.

    • Name: the name of the subscription.

    • Subscription: the type of the subscription. Select Queue.

    • Endpoint: the endpoint of the receiver. Select a queue.

    • (Optional) Message Filtering Tag: the tag that is used to filter messages.

    • Retry Policy: the retry policy. Valid values:

      • BACKOFF_RETRY: retries three times. The retry interval is a random value between 10 and 20 seconds.

      • DECAY_RETRY: retries 176 times within one day at the following retry intervals that are measured in seconds: 2^0, 2^1, ..., 512, 512, ..., and 512.

    • Message Format: the format in which messages are pushed. Valid values:

      • SIMPLIFIED: The message contains only the published message body and does not contain attribute information.

      • JSON: The message is in the JSON format and contains the message body and message attributes.

      • XML: The message is in the XML format and contains the message body and message attributes.

Step 3: Publish messages

  1. Log on to the SMQ 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 that you want to manage and click Publish Message in the Actions column.

  5. On the Publish Message page, set the following parameters and click Publish Message.

    • Message Content: the content of the message.

    • (Optional) Message Tag: the tag that is used to filter messages.

    • Subscription Type: the subscription type of the message that you want to push. Select Queue.