更新时间:2025-09-03 GMT+08:00

查询分区最早消息的位置

功能介绍

查询分区最早消息的位置。

URI

GET /v2/{project_id}/instances/{instance_id}/management/topics/{topic}/partitions/{partition}/beginning-message

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

参数解释

项目ID,获取方式请参见获取项目ID

约束限制

不涉及。

取值范围

不涉及。

默认取值

不涉及。

instance_id

String

参数解释

实例ID。获取方法如下:调用“查询所有实例列表”接口,从响应体中获取实例ID。

约束限制

不涉及。

取值范围

不涉及。

默认取值

不涉及。

topic

String

参数解释

Topic名称。

约束限制

Topic名称必须以字母开头且只支持大小写字母、中横线、下划线以及数字。

取值范围

不涉及。

默认取值

不涉及。

partition

Integer

参数解释

分区编号。

约束限制

不涉及。

取值范围

不涉及。

默认取值

不涉及。

请求参数

响应参数

状态码:200

表2 响应Body参数

参数

参数类型

描述

topic

String

参数解释

Topic名称。

取值范围

不涉及。

partition

Integer

参数解释

分区编号。

取值范围

不涉及。

offset

Integer

参数解释

消息位置。

取值范围

不涉及。

timestamp

Long

参数解释

生产消息的时间。

格式为Unix时间戳。单位为毫秒。

取值范围

不涉及。

请求示例

GET https://{endpoint}/v2/{project_id}/instances/{instance_id}/management/topics/{topic}/partitions/{partition}/beginning-message

响应示例

状态码:200

查询分区最早消息的位置成功。

{
  "topic" : "mytest",
  "partition" : 0,
  "offset" : 9,
  "timestamp" : 1568125039164
}

状态码

状态码

描述

200

查询分区最早消息的位置成功。

错误码

请参见错误码