All Products
Search
Document Center

ApsaraMQ for MQTT:QueryMqttTraceMessageOfClient

Last Updated:Aug 22, 2024

Queries messages on a device within a specific period of time. If a message is not sent or received as expected, you can call this operation to query the messaging status of the message to efficiently troubleshoot issues.

Operation description

  • Each successful call to the QueryMqttTraceMessageOfClient operation increases the messaging transactions per second (TPS) by one. This affects the billing of your instance. For more information, see Billing rules.
  • You can call this operation up to 500 times per second per account. If the limit is exceeded, throttling is triggered. This may affect your business. We recommend that you take note of this limit when you call this operation. For more information, see Limits on QPS.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
MqttRegionIdstringYes

The ID of the region where the ApsaraMQ for MQTT instance resides. For more information, see Endpoints .

cn-hangzhou
InstanceIdstringYes

The ID of the ApsaraMQ for MQTT instance. The ID must be consistent with the ID of the instance that the ApsaraMQ for MQTT client uses. You can view the instance ID in the Basic Information section of the Instance Details page that corresponds to the instance in the ApsaraMQ for MQTT console.

mqtt-cn-i7m26mf****
ClientIdstringYes

The client ID of the device whose messages you want to query.

GID_test@@@producer
BeginTimelongYes

The beginning of the time range to query. The value of this parameter is a UNIX timestamp in milliseconds.

1618646400000
EndTimelongYes

The end of the time range to query. The value of this parameter is a UNIX timestamp in milliseconds.

1621591200000
CurrentPageintegerYes

The number of the page to return. Pages start from page 1. If the input parameter value is greater than the total number of pages, the returned result is empty.

1
PageSizeintegerYes

The number of entries to return on each page. Valid values: 1 to 100.

5
ReversebooleanNo

Specifies whether the returned results are displayed in reverse chronological order. Valid values:

  • true: The returned results are displayed in reverse order of the time when messages are sent or received. This means that the latest sent or received message is displayed as the first entry and the earliest sent or received message is displayed as the last entry.
  • false: The returned results are displayed in order of the time when messages are sent or received. This means that the earliest sent or received message is displayed as the first entry and the latest sent or received message is displayed as the last entry.

If this parameter is not specified, the returned results are displayed in order of the time when messages are sent or received.

false

Response parameters

ParameterTypeDescriptionExample
object
CurrentPageinteger

The page number of the returned page.

1
RequestIdstring

The request ID. You can use the ID to troubleshoot issues. This parameter is a common parameter.

B096B9D6-62F3-4567-BB59-58D1362E****
PageSizeinteger

The number of entries returned per page.

10
Totallong

The total number of messages returned.

5
MessageOfClientListarray<object>

The returned messages.

object
Timestring

The time when the message was sent or received.

2021-05-21 15:08:19.234
Actionstring

The action on the message. Valid values:

  • pub_mqtt: The ApsaraMQ for MQTT client sends the message.
  • sub: The ApsaraMQ for MQTT client subscribes to the message.
  • push_offline: The ApsaraMQ for MQTT broker pushes the offline message to the ApsaraMQ for MQTT client.
pub_mqtt
ActionCodestring

The returned code for the action on the message. Valid values:

  • mqtt.trace.action.msg.pub.mqtt: This value is returned if the value of Action is pub_mqtt.
  • mqtt.trace.action.msg.sub: This value is returned if the value of Action is sub.
  • mqtt.trace.action.msg.push.offline: This value is returned if the value of Action is push_offline.
mqtt.trace.action.msg.pub.mqtt
ActionInfostring

The information returned for the action on the message. Valid values:

  • Pub From Mqtt Client: This value is returned if the value of Action is pub_mqtt.
  • Push To Mqtt Client: This value is returned if the value of Action is sub.
  • Push Offline Msg To Mqtt Client: This value is returned if the value of Action is push_offline.
Pub From Mqtt Client
MsgIdstring

The message ID.

AC1EC0030EAB78308DB16A3EC773****
ClientIdstring

The client ID of the device.

GID_test@@@producer

Examples

Sample success responses

JSONformat

{
  "CurrentPage": 1,
  "RequestId": "B096B9D6-62F3-4567-BB59-58D1362E****",
  "PageSize": 10,
  "Total": 5,
  "MessageOfClientList": [
    {
      "Time": "2021-05-21 15:08:19.234",
      "Action": "pub_mqtt",
      "ActionCode": "mqtt.trace.action.msg.pub.mqtt",
      "ActionInfo": "Pub From Mqtt Client",
      "MsgId": "AC1EC0030EAB78308DB16A3EC773****",
      "ClientId": "GID_test@@@producer"
    }
  ]
}

Error codes

HTTP status codeError codeError message
404ApiNotSupportThe specified API is not supported.
500SystemOverFlowAn error occurred while processing your request. Please try again.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
No change history