Updated on 2022-09-05 GMT+08:00

Querying Messages

Scenario

Query messages by message ID or queue for troubleshooting.

  • If the body size of a message is greater than 3 KB, you can download the message after the query.
  • Only messages in the current queue can be queried. Messages cannot be queried across queues.
  • When querying messages by queue, you can query messages only within the persistent storage time range.
Table 1 Query mode comparison

Query Mode

Query Criteria

Query Type

Description

Query by message ID

Messages ID

Exact query

Based on a message ID, you can exactly locate the corresponding message to obtain its attributes.

Query by queue

Queue+time range

Range query

Based on a queue and time range, you can obtain all the messages meeting the query criteria in batches. In this case, multiple messages are queried, causing difficulties in matching.

Prerequisites

A queue has been created. The queue has at least one message.

Procedure

  1. Log in to the management console.
  2. Click in the upper left corner of the management console and select a region.

    Select the same region as your application service.

  3. Click Service List, and choose Application > Distributed Message Service to open the DMS console.
  4. In the navigation pane, choose Queue Manager.
  5. Click the name of a queue for which you want to query the messages.
  6. On the queue details page, click the Message Query tab.
  7. Query messages in either of the following ways:

    • Click Query by Message ID. Enter a message ID in the search box and press Enter. The queried message body and attributes are displayed.

      When querying messages by message ID, you can only query messages in the chosen queue. Otherwise, the query fails and an error message is displayed, indicating that the specified message ID is invalid.

      Table 2 Parameter description

      Parameter

      Description

      ID

      Message ID.

      Queue ID

      Queue ID.

      Message Body

      Message body.

      Message Attributes

      List of attributes.

      Message Tags

      Message label.

      Message Size

      Message size.

      Created

      Date and time when a message was created.

      Operation

      This parameter is displayed only when the body size of a message is greater than 3 KB.

      After the query, you can download the message, which will be automatically saved as a .txt file.

    • Click Query by Queue. Specify the time range for query, and press Enter.

      You can set the time range to 72 hours at most.

      In the Operation column, click View Details to view the complete message bodies, IDs, and attributes.
      Table 3 Parameter description

      Parameter

      Description

      ID

      Message ID.

      Message Body

      Message body.

      Message Attributes

      List of attributes.

      Message Tags

      Message label.

      Message Size

      Message size.

      Created

      Date and time when a message was created.

      Operation

      If the body size of a message is greater than 3 KB, you can download the message after the query.

      The downloaded message will be automatically saved as a .txt file.