You can call the OnsMessageTrace operation to determine whether a message has been consumed based on its message ID.
Operation description
-
You can use this operation to check the consumption status of a message for preliminary troubleshooting when a consumption exception occurs.
-
This operation is based on the internal offset mechanism of ApsaraMQ for RocketMQ. The results are reliable in most scenarios. However, if you reset offsets or purge messages, the results may be inaccurate.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
mq:QueryMessageTrace |
get |
Topic
Topic
|
None |
|
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| Topic |
string |
Yes |
The topic of the message. |
test-mq_topic |
| MsgId |
string |
Yes |
The ID of the message whose trace you want to query. This is the message ID. |
1E05791C117818B4AAC23B1BB0CE**** |
| InstanceId |
string |
No |
The ID of the instance to which the message belongs. |
MQ_INST_111111111111_DOxxxxxx |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| RequestId |
string |
The ID of the request. This is a common parameter. Each request has a unique ID. Use this ID to troubleshoot issues. |
EAE5BE23-37A1-4354-94D6-E44AE17E**** |
| Data |
object |
||
| MessageTrack |
array<object> |
The query results. |
|
|
object |
|||
| TrackType |
string |
The current status. Valid values:
|
CONSUMED |
| ConsumerGroup |
string |
The group ID of the consumer that subscribes to the topic. |
GID_test_group_id |
| InstanceId |
string |
The ID of the instance to which the message belongs. |
MQ_INST_111111111111_DOxxxxxx |
Examples
Success response
JSON format
{
"RequestId": "EAE5BE23-37A1-4354-94D6-E44AE17E****",
"Data": {
"MessageTrack": [
{
"TrackType": "CONSUMED",
"ConsumerGroup": "GID_test_group_id",
"InstanceId": "MQ_INST_111111111111_DOxxxxxx"
}
]
}
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.