Scenarios
If you encounter abnormal message production and consumption, such as message loss or consumption failure, you can query abnormal messages in the TDMQ for CKafka (CKafka) console for troubleshooting. CKafka supports two methods for querying messages: query by offset and query by time. The applicable scenarios are as follows:
Query by offset: You can clearly know the partition ID where the message is sent to the topic and the message offset.
Query by time: You are unsure of the message location but know the time when the message was sent.
Constraints and Limitations
A single query displays up to 20 messages after the starting time or starting offset (if fewer than 20 messages exist after the starting time or starting offset, all messages will be displayed).
Querying messages also consumes a certain amount of bandwidth resources. Do not operate frequently.
Currently, only querying messages within 1 MB is supported.
Whether messages can be queried depends on the message retention mechanism. Users can configure how long messages can be retained or how much space they can occupy before deletion. Simultaneously, CKafka supports configuring a dynamic retention period for messages.
Operation Steps
2. In the left sidebar, select Message Query, select the target region, and set query conditions on the Message Query page.
Instance: Select the instance to view from the drop-down list.
Topic: Select the topic where the message resides in the drop-down list.
Query type: Support two methods: Query by offset and Query by start time.
Partition ID: Select the partition where the message resides.
Starting offset: When the query type is query by offset, enter the starting offset of the message.
Time: When the query type is query by time, set the starting time of the query accurate to the second.
3. Click Query to view message information.
Partition ID: Topic partition of the message.
Offset: Consumption offset of the message.
Timestamp: timestamp in ProducerRecord.
Operation:
Click Download Message to download messages in the format of header, key, or value. Batch download of messages is supported.
Click View Details to view the key and value of the message.