You need to enable JavaScript to run this app.
Message Queue for Kafka

Message Queue for Kafka

Copy page
Download PDF
User Guide
Message query
Copy page
Download PDF
Message query
After successfully connecting to Message Queue for Kafka, if a message consumption exception occurs, you can view detailed server-side message content through message query function. You can verify whether the message details on the server-side exactly match those on the producer or consumer side to troubleshoot message issues.​
Background information​
Message Queue for Kafka provides the following methods to query message details.​
  • Query by offset. Query messages from the specified topic, partition, and offset. This suits scenarios where the partition ID and message offset are clear.​
  • Query by time. Query message lists within a specified time range for a specific topic, partition, or all partitions. When querying by time range, messages that meet the criteria are filtered. This suits scenarios where message sending time period is clear.​
We recommend that you use message query function in the following scenarios:​
  • View the specific message content to verify whether it matches the production/consumption end.​
  • Download the specified message content for further troubleshooting.​
Note​
  • The storage duration of messages in Message Queue for Kafka is determined by the parameter Message retention period. The system regularly deletes messages that exceed this period. During viewing, some messages may expire and be deleted. You can adjust the message expiration and deletion policy by modifying the Message retention period parameter. For details, see Modify parameter configuration.​
  • When storage space is insufficient, the backend system deletes historical messages. Therefore, some messages may be unavailable for querying.​
  • Each query displays up to 16 results on the page. The total message content size does not exceed 10 MiB. For example, if the total size of the messages exceeds the 10 MiB limit because the 11th message body is too large, the system only returns the previous 10 results. You can click Load more to see more results. When the data volume is large, we recommend that you narrow the time range and query in batches.​
  • The console displays up to 1 KiB of content for each retrieved message. Any content beyond 1 KiB will be automatically intercepted. To view the complete message content, download the message to local device.​
Prerequisites​
Deploy the production-end service. Access Message Queue for Kafka.​
Query messages by offset​
  1. Select the region where the instance is located on the top menu bar.​
  1. Click the specified instance name on the Instances page.​
  1. Click Message query on the top tab bar.​
  1. Select Query by offset, and then specify the Topic, Partition, and Offset of the target message.​
tip​
After setting the Topic and partition, the page will display the selectable range for the offset. You need to set the starting offset within the specified range. Offsets outside this range have no messages to query.​
  1. Click Query.​
  • The page displays a list of messages that matches the filter criteria, including Topic name, partition, offset, key, value, message size, and storage time.​
  • ​
    Display item​
    Description​
    Topic name​
    The Topic to which the message is sent.​
    Partition​
    The Topic partition that corresponds to the message.​
    Offset​
    Offset of the message.​
    Key​
    Key of the message. If Key is not set when sending the message, the value here shows as "-". During page display, the Key will be forcibly converted to type String.​
    Value​
    Message body, the specific content of the message. To facilitate viewing, the message content is forcibly converted to string type when displayed on the page.​
    tip​
    The console displays up to 1 KiB of content for each retrieved message. Any content beyond 1 KiB will be automatically intercepted. To view the complete message content, download and decode the message.​
    Value message size​
    The length of this message body. The unit is byte.​
    Storage time​
    Message storage time, i.e., the timestamp in ProducerRecord.​
    ​
Query messages by time​
  1. Select the region where the instance is located on the top menu bar.​
  1. Click the specified instance name on the Instances page.​
  1. Click Message query on the top tab bar.​
  1. Select Query by time, then set the target message's topic, partition, and message storage period.​
tip​
Supports two methods: preset time and custom time. Various time periods are preset to facilitate message queries.​
  1. Click Query.​
  • The page displays a list of messages that matches the filter criteria, including Topic name, partition, offset, key, value, message size, and storage time.​
  • ​
    Display item​
    Description​
    Topic name​
    The Topic to which the message is sent.​
    Partition​
    The Topic partition that corresponds to the message. Supports setting to All. This means you can query messages across all partitions.​
    Offset​
    Offset of the message.​
    Key​
    Key of the message. If Key is not set when sending the message, the value here shows as "-". The Value is forcibly converted to String type.​
    Value​
    Message body, the specific content of the message. The Value is forcibly converted to String type.​
    tip​
    The console displays up to 1 KiB of content for each retrieved message. Any content beyond 1 KiB will be automatically intercepted. To view the complete message content, download and decode the message.​
    Value message size​
    The length of this message body. The unit is byte.​
    Storage time​
    Message storage time, i.e., the timestamp in ProducerRecord.​
    ​
Download messages​
After finding the specified message, you can download its content on the message query tab. You can troubleshoot production and consumption issues by comparing producer or consumer messages.​
tip​
Currently, batch message download is not supported.​
  1. Query messages by offset or time.​
  1. In the query results, locate the specified message and click Download message in the Actions column.​
  • The page automatically downloads message files in .txt format. The file displays full message content.​
​
Last updated: 2025.10.15 10:11:15