• Distributed Message Service

dms
  1. Help Center
  2. Distributed Message Service
  3. User Guide
  4. Getting Started
  5. Retrieving Messages

Retrieving Messages

Scenario

Messages can be retrieved from a queue.

Prerequisites

A queue has been created. The queue has at least one consumer group and at least one message.

NOTE:

In standard queues, messages are retained for at least 72 hours and will be deleted 72 hours later. However, in Kafka queues, messages are retained for 1 to 72 hours, depending on your choice.

Procedure

  1. Log in to the management console.
  2. Click  in the upper left corner of the management console and select a region and a project.
  3. Click Service List, and choose Application > Distributed Message Service to launch the DMS console.
  4. In the navigation pane, choose Queue Manager.
  5. Open the Retrieve Message dialog box using either of the methods:

    • Method 1

      In the queue list, choose More Retrieve Message in the same row as the queue from which messages will be retrieved.

    • Method 2
      1. Click the name of the queue from which messages will be retrieved.
      2. In the consumer group list, click Retrieve Message in the same row as the consumer group who will retrieve messages from the chosen queue.

  6. Specify Consumer Group NameMax. Message CountQueue Polling Interval, and Message Type. Then, click Start to retrieve the messages.

    Table 1 Parameter description

    Parameter

    Description

    Consumer Group Name

    Name of a consumer group.

    If you open the Retrieve Message dialog box by choosing More Retrieve Message in the queue list, the Consumer Group Name parameter is by default set to the name of the first consumer group in the chosen queue.

    If you open the Retrieve Message dialog box by clicking Retrieve Message in the consumer group list, the Consumer Group Name parameter is by default set to the name of the chosen consumer group.

    Queue Polling Interval

    Interval at which DMS polls the queue for messages. The value can be 3s5s10s, or 30s.

    Default value: 3s

    Message Type

    Type of messages to be retrieved.

    Values:

    • Normal

      Only normal messages are retrieved from the chosen queue.

    • Dead letter

      Only dead letter messages generated for the chosen consumer group are retrieved from the chosen queue.

    Default value: Normal

    If the Dead Letter Queue parameter is set to off at the queue creation time, only the Normal option is available in the Message Type drop-down list.

    Max. Message Count

    Maximum number of messages to be retrieved in a single polling cycle. The value can be 5 or 10.

    Default value: 5

    After you click the Start button, the console polls the queue at regular intervals for 5 minutes, whether there are messages in the queue. After 5 minutes, the polling stops automatically. To stop polling before then, click Stop and the polling will stop after the current cycle of polling completes.

    If you close the Retrieve Message dialog box or change the Consumer Group NameMax. Message Count, or Queue Polling Interval while messages are being retrieved, the message retrieval will stop after the current cycle of polling completes.

    Retrieved messages are displayed in the list. To view details such as the message body, message size, ID, attribute count, and attributes, click View Details in the same row as the chosen message. Message retrieval will not be interrupted when you are viewing details.

    NOTE:
    • Messages can be retrieved only once by each consumer group. Information about messages retrieved by the current consumer group is lost after the Retrieve Message dialog box is closed or another consumer group is selected to retrieve messages. However, the messages can still be retrieved by other consumer groups.
    • Messages from one queue are stored in different partitions to enable simultaneous retrieval of multiple messages by one consumer group. Each retrieval request can target messages in only one partition, preventing cross-partition management and access from adversely impacting performance.
    • If the message queue contains only a few messages and messages are distributed over partitions, the number of messages in a single partition may be less than the number of messages you specified to be retrieved in a single polling cycle. This means that each polling cycle will return fewer messages than expected. However, all messages in the queue will be retrieved after multiple cycles.
    Table 2 Parameters in the Messages Retrieved list

    Parameter

    Description

    Message Body (Condensed)

    Content of the message body.

    Content of messages in Kafka queues is encoded with Base64.

    ID

    Handler of the message.

    Body Size

    Size of the message body.

    Operation

    Clicking View Details in the Operation column displays the complete message body, complete message ID, and complete message attributes of the message retrieved.

    The Operation column is not displayed if the message is retrieved from a Kafka queue.