Scenario
By querying RocketMQ messages, you can perform the following functions:
l Monitoring message status: You can monitor the message status in real time, including consumption status (consumed or not), consumption progress, and number of retries. This helps identify issues such as abnormal message consumption or delay for timely response or adjustment.
l Troubleshooting and tracing: It helps to locate the causes of failed message consumption, such as consumer exceptions and network faults. You can also track the consumption path of messages for troubleshooting and fault position from message production to consumption.
l Statistics and analysis: You can collect statistics of and analyze messages, such as the number of messages sent, number of consumed messages, and consumption delay. This helps keep track of message handling, evaluate the performance and stability of the system, and take optimization and improvement measures accordingly.
l Data synchronization and recovery: You can learn about the message send time, content, and keywords for data synchronization and restoration. In case of a system failure or data loss, you can query the message information to restore data while ensuring the consistency and integrity of the data.
In RocketMQ, you can query the message information for monitoring, troubleshooting, statistical analysis and data synchronization and recovery. This greatly supports the stable operation of the system and data management.
Procedure
1. On the Console, click Message Query.
2. In the drop-down box, select the cluster name and broker name.
3. You can query messages by key, ID or offset.
l Query by Key
You can query messages by key. A key must be globally unique. Each query returns a maximum of 64 records with the same key.
Click View to query the content of the message body.
The logical offset represents the offset of a message in the logical queue, while the physical offset refers to the offset of a message in commitLog.
l Query by ID
Query messages by ID. Select a subscription group. Then you can query whether the message has been consumed by the subscription group and view Consumption Status.
Click View to query the content of the message body.
Meanings of consumption status:
(1) To-consume: unconsumed
(2) Consumed: acknowledged
(3) Consumed: pulled but not acknowledged
Tag3: Query by offset
l Query by Offset
Query messages by specific offset. Select a subscription group. Then you can query whether the message has been consumed by the subscription group and view Consumption Status.
Click View to query the content of the message body.