All Products
Search
Document Center

OnsMessageGetByMsgId

Last Updated: Apr 03, 2019

OnsMessageGetByMsgId

You can call this operation to query the information about a message by specifying the message ID and to determine whether the message has been consumed. The information includes properties such as the sending time, broker, key, and tag.

Description

Querying a message by message ID is an exact query. The message ID required by the search criteria is obtained from SendResult after a message is sent. Therefore, the service provider must store the results of message sending.

Request parameters

Name Type Required Description
PreventCache Long Yes The parameter used for CSRF verification, which can be set to the current system time. Unit: ms
InstanceId String No The ID of the instance.
MsgId String Yes The ID of the message you want to query (message ID).
Topic String Yes The topic of the message you want to query.

Response parameters

Name Type Description
RequestId String A common parameter. Each request has a unique ID.
HelpUrl String A help link.
Data Data The query results.

Fields in Data

Name Type Description
Topic String The topic of the message.
PropertyList List(MessageProperty) A list of message properties.
Body String The message body.
StoreSize Integer The message size.
BornTimestamp Long The time when the message was generated.
BornHost String The producer that generated the message.
StoreTimestamp Long The time when the broker stored the message.
StoreHost String The broker that stored the message.
MsgId String The message ID.
BodyCRC Integer The message body CRC.
ReconsumeTimes Integer The number of message consumption retries.

Examples

For more information about sample codes, see API sample code and endpoints.