You can call this operation to query the consumption status of a message based on a specified message ID.

This operation is implemented based on the internal offset mechanism of Message Queue for Apache RocketMQ. The results are correct in most cases. However, if you have reset the offset or cleared messages, the results may be incorrect.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes OnsMessageTrace

The operation that you want to perform. Set the value to OnsMessageTrace.

InstanceId String Yes MQ_INST_111111111111_DOxxxxxx

The ID of the Message Queue for Apache RocketMQ instance corresponding to the message that you want to query.

MsgId String Yes 1E05791C117818B4AAC23B1BB0CE****

The ID of the message that you want to query.

Topic String Yes test-mq_topic

The topic of the message that you want to query.

Response parameters

Parameter Type Example Description
Data Array

The returned query results.

MessageTrack
ConsumerGroup String GID_test_group_id

The group ID of the consumer that subscribes to the topic.

InstanceId String MQ_INST_111111111111_DOxxxxxx

The ID of the Message Queue for Apache RocketMQ instance corresponding to the message.

TrackType String CONSUMED

The current status of the message. Valid values:

  • CONSUMED: The message has been consumed.
  • CONSUMED_BUT_FILTERED: The message has been filtered out.
  • NOT_CONSUME_YET: The message has not been consumed yet.
  • NOT_ONLINE: The consumer instance is offline.
  • UNKNOWN: The message is in other unknown state.
RequestId String EAE5BE23-37A1-4354-94D6-E44AE17E06A7

The ID of the request. This is a common parameter.

Examples

Sample requests

http(s)://[Endpoint]/? Action=OnsMessageTrace
&InstanceId=MQ_INST_111111111111_DOxxxxxx
&MsgId=1E05791C117818B4AAC23B1BB0CE****
&Topic=test-mq_topic
&<Common request parameters>

Sample success responses

XML format

<OnsMessageTraceResponse>
  <Data>
        <MessageTrack>
              <InstanceId>MQ_INST_111111111111_DOxxxxxx</InstanceId>
              <ConsumerGroup>GID_test_group_id</ConsumerGroup>
              <TrackType>CONSUMED</TrackType>
        </MessageTrack>
  </Data>
  <RequestId>EAE5BE23-37A1-4354-94D6-E44AE17E06A7</RequestId>
</OnsMessageTraceResponse>

JSON format

{
	"Data": {
		"MessageTrack": [
			{
				"InstanceId": "MQ_INST_111111111111_DOxxxxxx",
				"ConsumerGroup": "GID_test_group_id",
				"TrackType": "CONSUMED"
			}
		]
	},
	"RequestId": "EAE5BE23-37A1-4354-94D6-E44AE17E06A7"
}

Error codes

For a list of error codes, visit the API Error Center.