Distributed Message Service RocketMQ

Querying Messages by MsgId

2024-07-08 08:48:54

API Introduction

Used to query messages by MsgId.

API Restrictions

None.

URl

GET https://[endpoint]/v2/message/queryByMsgId

Request Parameters

Request Parameters

Required or Not

Position

Parameter Type

Description

msgId

Yes

url

String

Message   ID

prodInstId

Yes

url

String

Instance   ID

groupName

Yes

url

String

Subscription   Group Name

Response Parameter

Response Parameter

Parameter Type

Description

statusCode

String

The   status code of the interface on the system layer. Success: 800; failure: 900.

message

String

Status   Description

returnObj

String

Return   the object. The parameters included in this parameter are described in the   comments in Response Examples.

Description of Return Value data

Response Parameter

Parameter Type

Description

queueId

Int

Queue   ID

storeSize

Int

Message   Size

queueOffset

Long

Queue   Offset

sysFlag

Int

System   Flag

bornTimestamp

Long

Generation Timestamp, in milliseconds.

bornHost

String

Generation Host

storeTimestamp

Long

Storage Timestamp, in milliseconds.

msgId

String

Message   ID

commitLogOffset

Long

Physical   Offset

bodyCRC

Int

Body   CRC

reconsumeTimes

Int

Number   of Retries

preparedTransactionOffset

Long

Transaction   Offset

properties

Map<String,   String>

UNIQ_KEY:   indicates the unique key

messageBody

String

Message   body

status

String

Consumption   Status:

TO_CONSUME:   Not consumed

CONSUMING:   Consuming

CONSUMED:   Consumed

 

Sample Request

GET https://[endpoint]/v2/message/ queryByMsgId?msgId=C0A847BC000020E600000000000045FE&prodInstId=70687660456281088&groupName=group

Examples of a Successful Response

{

    "returnObj":{

        "data":{

            "queueId":3,

            "storeSize":499,

            "queueOffset":6,

            "sysFlag":0,

            "bornTimestamp":1661852864101,

            "bornHost":"192.168.71.1:62644",

            "storeTimestamp":1661852864113,

            "storeHost":"192.168.71.188:8422",

            "msgId":"C0A847BC000020E60000000000003FEE",

            "commitLogOffset":16366,

            "bodyCRC":1507589040,

            "reconsumeTimes":0,

            "preparedTransactionOffset":0,

            "topic":"test",

            "properties":{

                "UNIQ_KEY":"050562442CE418B4AAC29929F6640000"

            },

            "messageBody":"9Y2nOMMHZQL3RpBO5MlRV3tJDQimX6Ee4pvcxQHeRbMWWrrOU1kkG0vknO8QfobqQTUxMO6oRNZKEzAqfTJ6ohYBQgeKVFMenNXpeqTBcbzEOFUi673TTphZjJ8WSftmvyKT0oH0j3LTQYcpVwYlC8iz0SpJh0KSeAnPJ3RMa6vH9qmGgveoGRm8cq4dl19rqYciBnvxaKCNi684ff8u4CrwDqrjlgW3tFRnZkRj5pIC8SjS26npRSXLKcQUHRPvGMHqlXTkY45WOUOJABhLI31pzJersz6tnOjGmQ0GNQb6VNNKTzqk2SbH3P6LKL7bJwdGs5bw1j43s2m5U9PZCiA0asasFF",

            "status":"TO_CONSUME"

        }

    },

    "message":"success",

    "statusCode":800

}

Example of a Failed Response

{

    "returnObj": {},

    "message": "...",

    "statusCode": "900"

}


bZCPOAaT99c.