Queries the information about a message by specifying the message ID and determines whether the message has been consumed.
Operation description
- If a message is not consumed as expected, you can call this operation to query the information about the message for troubleshooting.
- This operation uses the exact match method to query a message based on the message ID. You can obtain the message ID from the SendResult parameter that is returned after the message is sent. You must store the returned information after each message is sent. The queried information about a message includes the point in time when the message was sent, the broker on which the message is stored, and the attributes of the message such as the message key and tag.
Debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action
policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- The required resource types are displayed in bold characters.
- If the permissions cannot be granted at the resource level,
All Resources
is used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
mq:QueryMessage | Read |
|
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
MsgId | string | Yes | The ID of the message that you want to query. | 1E0578FE110F18B4AAC235C05F2***** |
Topic | string | Yes | The topic that contains the message you want to query. | test-mq_topic |
InstanceId | string | Yes | The ID of the instance to which the message you want to query belongs. | MQ_INST_111111111111_DOxxxxxx |
Response parameters
Examples
Sample success responses
JSON
format
{
"RequestId": "A07E3902-B92E-44A6-B6C5-6AA111111****",
"Data": {
"StoreSize": 407,
"ReconsumeTimes": 1,
"StoreTimestamp": 1570761026708,
"InstanceId": "MQ_INST_111111111111_DOxxxxxx",
"MsgId": "1E0578FE110F18B4AAC235C0C8460BA2",
"StoreHost": "11.220.***.***:10911",
"Topic": "test-mq_topic",
"PropertyList": {
"MessageProperty": [
{
"Value": "TagA",
"Name": "TAGS"
}
]
},
"BornTimestamp": 1570761026630,
"BodyCRC": 914112295,
"BornHost": "42.120.**.**:64646"
}
}
Error codes
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|
View the information about a message in the console
You can also view the information about a message in the Message Queue for Apache RocketMQ console.**** For more information, see Query a message.