OffsetCommit
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 9 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
- 8
- Encoded at
- v9
- Flexible versions
- 8+
- Headers
- req v2, resp v1
- Request versions
- 2-9
- Response versions
- 2-9
- Request size
- 45 bytes
- Response size
- 25 bytes
framerpc headerrequest bodyRecordBatchRecordresponse bodytagged_fields
Request
OffsetCommitRequest v9, request header v2, 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
OffsetCommitRequest message v9 [0x0000, 45B] +-- Frame [0x0000, 4B] length-delimited framing | +-- size int32 = 41 [0x0000, 4B] number of bytes that follow, patched after encoding +-- RequestHeader v2 [0x0004, 11B] common request header | +-- request_api_key int16 = 8 (OffsetCommit) [0x0004, 2B] numeric id of the API being invoked | +-- request_api_version int16 = 9 [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 +-- OffsetCommitRequest struct [0x000f, 30B] message body, version 9 +-- GroupId string = "" (compact, len+1=1) [0x000f, 1B] The unique group identifier. +-- GenerationIdOrMemberEpoch int32 = 0 [0x0010, 4B] The generation of the group if using the classic group protocol or the memb... +-- MemberId string = "" (compact, len+1=1) [0x0014, 1B] The member ID assigned by the group coordinator. +-- GroupInstanceId string = "" (compact, len+1=1) [0x0015, 1B] The unique identifier of the consumer instance provided by end user. +-- Topics []OffsetCommitRequestTopic = 1 element [0x0016, 22B] The topics to commit offsets for. | +-- length uvarint = 2 (compact, n+1) [0x0016, 1B] one sample element follows | +-- OffsetCommitRequestTopic[0] OffsetCommitRequestTopic = struct [0x0017, 21B] | +-- Name string = "" (compact, len+1=1) [0x0017, 1B] The topic name. | +-- Partitions []OffsetCommitRequestPartition = 1 element [0x0018, 19B] Each partition to commit offsets for. | | +-- length uvarint = 2 (compact, n+1) [0x0018, 1B] one sample element follows | | +-- OffsetCommitRequestPartition[0] OffsetCommitRequestPartition = struct [0x0019, 18B] | | +-- PartitionIndex int32 = 0 [0x0019, 4B] The partition index. | | +-- CommittedOffset int64 = 0 [0x001d, 8B] The message offset to be committed. | | +-- CommittedLeaderEpoch int32 = 0 [0x0025, 4B] The leader epoch of this partition. | | +-- CommittedMetadata string = "" (compact, len+1=1) [0x0029, 1B] Any associated metadata the client wants to keep. | | +-- 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": 8, "type": "request", "listeners": ["broker"], "name": "OffsetCommitRequest", // Versions 0-1 were removed in Apache Kafka 4.0, Version 2 is the new baseline. // // Version 1 adds timestamp and group membership information, as well as the commit timestamp. // // Version 2 adds retention time. It removes the commit timestamp added in version 1. // // Version 3 and 4 are the same as version 2. // // Version 5 removes the retention time, which is now controlled only by a broker configuration. // // Version 6 adds the leader epoch for fencing. // // version 7 adds a new field called groupInstanceId to indicate member identity across restarts. // // Version 8 is the first flexible version. // // Version 9 is the first version that can be used with the new consumer group protocol (KIP-848). The // request is the same as version 8. "validVersions": "2-9", "flexibleVersions": "8+", "fields": [ { "name": "GroupId", "type": "string", "versions": "0+", "entityType": "groupId", "about": "The unique group identifier." }, { "name": "GenerationIdOrMemberEpoch", "type": "int32", "versions": "1+", "default": "-1", "ignorable": true, "about": "The generation of the group if using the classic group protocol or the member epoch if using the consumer protocol." }, { "name": "MemberId", "type": "string", "versions": "1+", "ignorable": true, "about": "The member ID assigned by the group coordinator." }, { "name": "GroupInstanceId", "type": "string", "versions": "7+", "nullableVersions": "7+", "default": "null", "about": "The unique identifier of the consumer instance provided by end user." }, { "name": "RetentionTimeMs", "type": "int64", "versions": "2-4", "default": "-1", "ignorable": true, "about": "The time period in ms to retain the offset." }, { "name": "Topics", "type": "[]OffsetCommitRequestTopic", "versions": "0+", "about": "The topics to commit offsets for.", "fields": [ { "name": "Name", "type": "string", "versions": "0+", "entityType": "topicName", "about": "The topic name." }, { "name": "Partitions", "type": "[]OffsetCommitRequestPartition", "versions": "0+", "about": "Each partition to commit offsets for.", "fields": [ { "name": "PartitionIndex", "type": "int32", "versions": "0+", "about": "The partition index." }, { "name": "CommittedOffset", "type": "int64", "versions": "0+", "about": "The message offset to be committed." }, { "name": "CommittedLeaderEpoch", "type": "int32", "versions": "6+", "default": "-1", "ignorable": true, "about": "The leader epoch of this partition." }, { "name": "CommittedMetadata", "type": "string", "versions": "0+", "nullableVersions": "0+", "about": "Any associated metadata the client wants to keep." } ]} ]} ] }
Response
OffsetCommitResponse v9, response header v1, 25 bytes on the wire
byte layout (25 bytes, 16 bytes per row)
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
0000
0010
object tree
OffsetCommitResponse message v9 [0x0000, 25B] +-- Frame [0x0000, 4B] length-delimited framing | +-- size int32 = 21 [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 +-- OffsetCommitResponse struct [0x0009, 16B] message body, version 9 +-- ThrottleTimeMs int32 = 0 [0x0009, 4B] The duration in milliseconds for which the request was throttled due to a q... +-- Topics []OffsetCommitResponseTopic = 1 element [0x000d, 11B] The responses for each topic. | +-- length uvarint = 2 (compact, n+1) [0x000d, 1B] one sample element follows | +-- OffsetCommitResponseTopic[0] OffsetCommitResponseTopic = struct [0x000e, 10B] | +-- Name string = "" (compact, len+1=1) [0x000e, 1B] The topic name. | +-- Partitions []OffsetCommitResponsePartition = 1 element [0x000f, 8B] The responses for each partition in the topic. | | +-- length uvarint = 2 (compact, n+1) [0x000f, 1B] one sample element follows | | +-- OffsetCommitResponsePartition[0] OffsetCommitResponsePartition = struct [0x0010, 7B] | | +-- PartitionIndex int32 = 0 [0x0010, 4B] The partition index. | | +-- ErrorCode int16 = 0 [0x0014, 2B] The error code, or 0 if there was no error. | | +-- tagged_fields uvarint = 0 [0x0016, 1B] number of tagged fields in this struct | +-- tagged_fields uvarint = 0 [0x0017, 1B] number of tagged fields in this struct +-- tagged_fields uvarint = 0 [0x0018, 1B] number of tagged fields in this struct
kafka message schema (.json)
{ "apiKey": 8, "type": "response", "name": "OffsetCommitResponse", // Versions 0-1 were removed in Apache Kafka 4.0, Version 2 is the new baseline. // // Versions 1 and 2 are the same as version 0. // // Version 3 adds the throttle time to the response. // // Starting in version 4, on quota violation, brokers send out responses before throttling. // // Versions 5 and 6 are the same as version 4. // // Version 7 offsetCommitRequest supports a new field called groupInstanceId to indicate member identity across restarts. // // Version 8 is the first flexible version. // // Version 9 is the first version that can be used with the new consumer group protocol (KIP-848). The response is // the same as version 8 but can return STALE_MEMBER_EPOCH when the new consumer group protocol is used and // GROUP_ID_NOT_FOUND when the group does not exist for both protocols. "validVersions": "2-9", "flexibleVersions": "8+", // Supported errors: // - GROUP_AUTHORIZATION_FAILED (version 0+) // - NOT_COORDINATOR (version 0+) // - COORDINATOR_NOT_AVAILABLE (version 0+) // - COORDINATOR_LOAD_IN_PROGRESS (version 0+) // - ILLEGAL_GENERATION (version 1+) // - UNKNOWN_MEMBER_ID (version 1+) // - INVALID_COMMIT_OFFSET_SIZE (version 0+) // - FENCED_MEMBER_EPOCH (version 7+) // - GROUP_ID_NOT_FOUND (version 9+) // - STALE_MEMBER_EPOCH (version 9+) "fields": [ { "name": "ThrottleTimeMs", "type": "int32", "versions": "3+", "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": "[]OffsetCommitResponseTopic", "versions": "0+", "about": "The responses for each topic.", "fields": [ { "name": "Name", "type": "string", "versions": "0+", "entityType": "topicName", "about": "The topic name." }, { "name": "Partitions", "type": "[]OffsetCommitResponsePartition", "versions": "0+", "about": "The responses for each partition in the topic.", "fields": [ { "name": "PartitionIndex", "type": "int32", "versions": "0+", "about": "The partition index." }, { "name": "ErrorCode", "type": "int16", "versions": "0+", "about": "The error code, or 0 if there was no error." } ]} ]} ] }