All Products
Search
Document Center

ApsaraMQ for RocketMQ:OnsMessageDetail

Last Updated:Jan 04, 2026

You can call OnsMessageDetail to query the details of a specific message.

Operation description

Important Alibaba Cloud OpenAPI is a control-plane API. You can use it to manage and query Alibaba Cloud service resources. Do not use OpenAPI for core data links that send and receive messages because this can create threats to your data links.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

mq:QueryMessageDetail

get

Topic

acs:mq:{#regionId}:{#accountId}:{#TopicName}

Topic

acs:mq:{#regionId}:{#accountId}:{#InstanceId}%{#TopicName}

None
  • mq:OnsInstanceBaseInfo

Request parameters

Parameter

Type

Required

Description

Example

InstanceId

string

Yes

The ID of the ApsaraMQ for RocketMQ instance.

MQ_INST_184681981******_BXig0x6A

Topic

string

Yes

The topic of the message to query.

test-mq_topic

MsgId

string

Yes

The ID of the message to query. This is the message ID.

1E0578FE110F18B4AAC235C0******

Response elements

Element

Type

Description

Example

object

Schema of Response

RequestId

string

A common parameter. The ID of the request. Each request has a unique ID. Use this ID to troubleshoot issues.

EAE5BE23-37A1-4354-94D6-E44AE17E****

Data

object

The query result.

StoreSize

integer

The size of the message. Unit: KB.

2

ReconsumeTimes

integer

The number of times the message consumption is retried.

0

StoreTimestamp

integer

The UNIX timestamp when the message was stored on the server-side. Unit: milliseconds.

1570761026708

Body

string

The message body, which is a Base64-encoded string.

aGVsbG8=

InstanceId

string

The ID of the ApsaraMQ for RocketMQ instance.

MQ_INST_184681981******_BXig0x6A

MsgId

string

The message ID.

1E0578FE110F18B4AAC235C05F2*****

StoreHost

string

The server instance where the message is stored.

11.220.***.***:10911

Topic

string

The topic to which the message belongs.

test-mq_topic

PropertyList

array<object>

The list of message attributes.

object

Value

string

The value of the message attribute.

MSG_REGION

Name

string

The message attribute. Valid values:

  • TRACE_ON: Indicates whether a message trace exists.

  • MSG_REGION: The region ID of the instance that contains the message topic.

  • __MESSAGE_DECODED_TIME: The time when the message was decoded.

  • __BORNHOST: The IP address of the producer client.

  • UNIQ_KEY: The unique identifier of the message. This is the message ID.

For more information, see Terms.

cn-hangzhou

BornTimestamp

integer

The UNIX timestamp when the message was generated. Unit: milliseconds.

1570761026630

BodyCRC

integer

The cyclic redundancy check (CRC) value of the message body.

907060870

BornHost

string

The client instance that generated the message.

42.120.**.**:64646

BodyStr

string

The content of the message body.

hello

Examples

Success response

JSON format

{
  "RequestId": "EAE5BE23-37A1-4354-94D6-E44AE17E****",
  "Data": {
    "StoreSize": 2,
    "ReconsumeTimes": 0,
    "StoreTimestamp": 1570761026708,
    "Body": "aGVsbG8=",
    "InstanceId": "MQ_INST_184681981******_BXig0x6A",
    "MsgId": "1E0578FE110F18B4AAC235C05F2*****",
    "StoreHost": "11.220.***.***:10911",
    "Topic": "test-mq_topic",
    "PropertyList": [
      {
        "Value": "MSG_REGION",
        "Name": "cn-hangzhou"
      }
    ],
    "BornTimestamp": 1570761026630,
    "BodyCRC": 907060870,
    "BornHost": "42.120.**.**:64646",
    "BodyStr": "hello"
  }
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.