更新时间:2024-01-30 GMT+08:00
分享

查询分区指定时间段的消息

当前页面API为历史版本API,未来可能停止维护。

URI

GET /v1.0/{project_id}/instances/{instance_id}/manage/topics/{topic}/messages?partition={partition}&start_time={start_time}&end_time={end_time}&limit={limit}&offset={offset}

参数说明请参考表1

表1 参数说明

参数

类型

必选

说明

project_id

String

项目ID。

instance_id

String

实例ID。

topic

String

Topic名称。

partition

Integer

分区编号,默认值为-1,若传入值为-1,则查询所有分区。

start_time

Long

查询起始时间,为unix时间戳格式,默认值为0。

end_time

Long

查询结束时间,为unix时间戳格式,默认值为系统当前时间。

limit

Integer

单页返回消息数,默认值为10。

offset

Integer

查询的页码,默认值为1。

请求消息

请求参数

请求示例

无。

响应消息

响应参数

参数说明见表2

表2 响应参数说明

参数

类型

说明

messages

Array<Object>

消息列表,见表3

messages_count

Long

消息总数。

offsets_count

Integer

总页数。

offset

Integer

当前页数。

表3 messages参数说明

参数

类型

说明

topic

String

topic名称。

partition

Integer

分区编号。

message_offset

Long

消息编号。

size

Integer

消息大小,单位字节。

timestamp

Long

消息时间戳。

响应示例

{
    "messages": [
        {
            "topic": "mytest",
            "partition": 0,
            "message_offset": 7,
            "size": 6,
            "timestamp": 1568125036045
        }
    ],
    "messages_count": 1,
    "offsets_count": 1,
    "offset": 1
}
分享:

    相关文档

    相关产品