ListOffsets
This page encodes the smallest legal instance of the request and the response: numeric fields are zero, strings and byte arrays are empty, every array carries exactly one sample element, and any records field holds one empty 61-byte RecordBatch v2. Version 10 is a flexible version, so every struct is terminated by a uvarint tagged-field count and strings and arrays carry compact length-plus-one prefixes. Sizes below include the leading int32 size prefix.
- API key
- 2
- Encoded at
- v10
- Flexible versions
- 6+
- Headers
- req v2, resp v1
- Request versions
- 1-10
- Response versions
- 1-10
- Request size
- 46 bytes
- Response size
- 45 bytes
framerpc headerrequest bodyRecordBatchRecordresponse bodytagged_fields
Request
ListOffsetsRequest v10, request header v2, 46 bytes on the wire
byte layout (46 bytes, 16 bytes per row)
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
0000
0010
0020
object tree
ListOffsetsRequest message v10 [0x0000, 46B] +-- Frame [0x0000, 4B] length-delimited framing | +-- size int32 = 42 [0x0000, 4B] number of bytes that follow, patched after encoding +-- RequestHeader v2 [0x0004, 11B] common request header | +-- request_api_key int16 = 2 (ListOffsets) [0x0004, 2B] numeric id of the API being invoked | +-- request_api_version int16 = 10 [0x0006, 2B] version of the API being invoked | +-- correlation_id int32 = 0 [0x0008, 4B] echoed back by the broker in the response | +-- client_id nullable_string = "" (int16 len=0) [0x000c, 2B] always a non-flexible int16-prefixed string | +-- tagged_fields uvarint = 0 [0x000e, 1B] number of tagged fields in the header +-- ListOffsetsRequest struct [0x000f, 31B] message body, version 10 +-- ReplicaId int32 = 0 [0x000f, 4B] The broker ID of the requester, or -1 if this request is being made by a no... +-- IsolationLevel int8 = 0 [0x0013, 1B] This setting controls the visibility of transactional records. Using READ_U... +-- Topics []ListOffsetsTopic = 1 element [0x0014, 21B] Each topic in the request. | +-- length uvarint = 2 (compact, n+1) [0x0014, 1B] one sample element follows | +-- ListOffsetsTopic[0] ListOffsetsTopic = struct [0x0015, 20B] | +-- Name string = "" (compact, len+1=1) [0x0015, 1B] The topic name. | +-- Partitions []ListOffsetsPartition = 1 element [0x0016, 18B] Each partition in the request. | | +-- length uvarint = 2 (compact, n+1) [0x0016, 1B] one sample element follows | | +-- ListOffsetsPartition[0] ListOffsetsPartition = struct [0x0017, 17B] | | +-- PartitionIndex int32 = 0 [0x0017, 4B] The partition index. | | +-- CurrentLeaderEpoch int32 = 0 [0x001b, 4B] The current leader epoch. | | +-- Timestamp int64 = 0 [0x001f, 8B] The current timestamp. | | +-- tagged_fields uvarint = 0 [0x0027, 1B] number of tagged fields in this struct | +-- tagged_fields uvarint = 0 [0x0028, 1B] number of tagged fields in this struct +-- TimeoutMs int32 = 0 [0x0029, 4B] The timeout to await a response in milliseconds for requests that require r... +-- tagged_fields uvarint = 0 [0x002d, 1B] number of tagged fields in this struct
kafka message schema (.json)
{ "apiKey": 2, "type": "request", "listeners": ["broker"], "name": "ListOffsetsRequest", // Version 0 was removed in Apache Kafka 4.0, Version 1 is the new baseline. // // Version 1 removes MaxNumOffsets. From this version forward, only a single // offset can be returned. // // Version 2 adds the isolation level, which is used for transactional reads. // // Version 3 is the same as version 2. // // Version 4 adds the current leader epoch, which is used for fencing. // // Version 5 is the same as version 4. // // Version 6 enables flexible versions. // // Version 7 enables listing offsets by max timestamp (KIP-734). // // Version 8 enables listing offsets by local log start offset (KIP-405). // // Version 9 enables listing offsets by last tiered offset (KIP-1005). // // Version 10 enables async remote list offsets support (KIP-1075) "validVersions": "1-10", "flexibleVersions": "6+", "latestVersionUnstable": false, "fields": [ { "name": "ReplicaId", "type": "int32", "versions": "0+", "entityType": "brokerId", "about": "The broker ID of the requester, or -1 if this request is being made by a normal consumer." }, { "name": "IsolationLevel", "type": "int8", "versions": "2+", "about": "This setting controls the visibility of transactional records. Using READ_UNCOMMITTED (isolation_level = 0) makes all records visible. With READ_COMMITTED (isolation_level = 1), non-transactional and COMMITTED transactional records are visible. To be more concrete, READ_COMMITTED returns all data from offsets smaller than the current LSO (last stable offset), and enables the inclusion of the list of aborted transactions in the result, which allows consumers to discard ABORTED transactional records." }, { "name": "Topics", "type": "[]ListOffsetsTopic", "versions": "0+", "about": "Each topic in the request.", "fields": [ { "name": "Name", "type": "string", "versions": "0+", "entityType": "topicName", "about": "The topic name." }, { "name": "Partitions", "type": "[]ListOffsetsPartition", "versions": "0+", "about": "Each partition in the request.", "fields": [ { "name": "PartitionIndex", "type": "int32", "versions": "0+", "about": "The partition index." }, { "name": "CurrentLeaderEpoch", "type": "int32", "versions": "4+", "default": "-1", "ignorable": true, "about": "The current leader epoch." }, { "name": "Timestamp", "type": "int64", "versions": "0+", "about": "The current timestamp." } ]} ]}, { "name": "TimeoutMs", "type": "int32", "versions": "10+", "ignorable": true, "about": "The timeout to await a response in milliseconds for requests that require reading from remote storage for topics enabled with tiered storage." } ] }
Response
ListOffsetsResponse v10, response header v1, 45 bytes on the wire
byte layout (45 bytes, 16 bytes per row)
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
0000
0010
0020
object tree
ListOffsetsResponse message v10 [0x0000, 45B] +-- Frame [0x0000, 4B] length-delimited framing | +-- size int32 = 41 [0x0000, 4B] number of bytes that follow, patched after encoding +-- ResponseHeader v1 [0x0004, 5B] common response header | +-- correlation_id int32 = 0 [0x0004, 4B] matches the correlation_id of the request | +-- tagged_fields uvarint = 0 [0x0008, 1B] number of tagged fields in the header +-- ListOffsetsResponse struct [0x0009, 36B] message body, version 10 +-- ThrottleTimeMs int32 = 0 [0x0009, 4B] The duration in milliseconds for which the request was throttled due to a q... +-- Topics []ListOffsetsTopicResponse = 1 element [0x000d, 31B] Each topic in the response. | +-- length uvarint = 2 (compact, n+1) [0x000d, 1B] one sample element follows | +-- ListOffsetsTopicResponse[0] ListOffsetsTopicResponse = struct [0x000e, 30B] | +-- Name string = "" (compact, len+1=1) [0x000e, 1B] The topic name. | +-- Partitions []ListOffsetsPartitionResponse = 1 element [0x000f, 28B] Each partition in the response. | | +-- length uvarint = 2 (compact, n+1) [0x000f, 1B] one sample element follows | | +-- ListOffsetsPartitionResponse[0] ListOffsetsPartitionResponse = struct [0x0010, 27B] | | +-- PartitionIndex int32 = 0 [0x0010, 4B] The partition index. | | +-- ErrorCode int16 = 0 [0x0014, 2B] The partition error code, or 0 if there was no error. | | +-- Timestamp int64 = 0 [0x0016, 8B] The timestamp associated with the returned offset. | | +-- Offset int64 = 0 [0x001e, 8B] The returned offset. | | +-- LeaderEpoch int32 = 0 [0x0026, 4B] The leader epoch associated with the returned offset. | | +-- tagged_fields uvarint = 0 [0x002a, 1B] number of tagged fields in this struct | +-- tagged_fields uvarint = 0 [0x002b, 1B] number of tagged fields in this struct +-- tagged_fields uvarint = 0 [0x002c, 1B] number of tagged fields in this struct
kafka message schema (.json)
{ "apiKey": 2, "type": "response", "name": "ListOffsetsResponse", // Version 0 was removed in Apache Kafka 4.0, Version 1 is the new baseline. // // Version 1 removes the offsets array in favor of returning a single offset. // Version 1 also adds the timestamp associated with the returned offset. // // Version 2 adds the throttle time. // // Starting in version 3, on quota violation, brokers send out responses before throttling. // // Version 4 adds the leader epoch, which is used for fencing. // // Version 5 adds a new error code, OFFSET_NOT_AVAILABLE. // // Version 6 enables flexible versions. // // Version 7 is the same as version 6 (KIP-734). // // Version 8 enables listing offsets by local log start offset. // This is the earliest log start offset in the local log. (KIP-405). // // Version 9 enables listing offsets by last tiered offset (KIP-1005). // // Version 10 enables async remote list offsets support (KIP-1075) "validVersions": "1-10", "flexibleVersions": "6+", "fields": [ { "name": "ThrottleTimeMs", "type": "int32", "versions": "2+", "ignorable": true, "about": "The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota." }, { "name": "Topics", "type": "[]ListOffsetsTopicResponse", "versions": "0+", "about": "Each topic in the response.", "fields": [ { "name": "Name", "type": "string", "versions": "0+", "entityType": "topicName", "about": "The topic name." }, { "name": "Partitions", "type": "[]ListOffsetsPartitionResponse", "versions": "0+", "about": "Each partition in the response.", "fields": [ { "name": "PartitionIndex", "type": "int32", "versions": "0+", "about": "The partition index." }, { "name": "ErrorCode", "type": "int16", "versions": "0+", "about": "The partition error code, or 0 if there was no error." }, { "name": "Timestamp", "type": "int64", "versions": "1+", "default": "-1", "ignorable": false, "about": "The timestamp associated with the returned offset." }, { "name": "Offset", "type": "int64", "versions": "1+", "default": "-1", "ignorable": false, "about": "The returned offset." }, { "name": "LeaderEpoch", "type": "int32", "versions": "4+", "default": "-1", "about": "The leader epoch associated with the returned offset."} ]} ]} ] }