TxnOffsetCommit
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 5 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
- 28
- Encoded at
- v5
- Flexible versions
- 3+
- Headers
- req v2, resp v1
- Request versions
- 0-5
- Response versions
- 0-5
- Request size
- 56 bytes
- Response size
- 25 bytes
framerpc headerrequest bodyRecordBatchRecordresponse bodytagged_fields
Request
TxnOffsetCommitRequest v5, request header v2, 56 bytes on the wire
byte layout (56 bytes, 16 bytes per row)
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
0000
0010
0020
0030
object tree
TxnOffsetCommitRequest message v5 [0x0000, 56B] +-- Frame [0x0000, 4B] length-delimited framing | +-- size int32 = 52 [0x0000, 4B] number of bytes that follow, patched after encoding +-- RequestHeader v2 [0x0004, 11B] common request header | +-- request_api_key int16 = 28 (TxnOffsetCommit) [0x0004, 2B] numeric id of the API being invoked | +-- request_api_version int16 = 5 [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 +-- TxnOffsetCommitRequest struct [0x000f, 41B] message body, version 5 +-- TransactionalId string = "" (compact, len+1=1) [0x000f, 1B] The ID of the transaction. +-- GroupId string = "" (compact, len+1=1) [0x0010, 1B] The ID of the group. +-- ProducerId int64 = 0 [0x0011, 8B] The current producer ID in use by the transactional ID. +-- ProducerEpoch int16 = 0 [0x0019, 2B] The current epoch associated with the producer ID. +-- GenerationId int32 = 0 [0x001b, 4B] The generation of the consumer. +-- MemberId string = "" (compact, len+1=1) [0x001f, 1B] The member ID assigned by the group coordinator. +-- GroupInstanceId string = "" (compact, len+1=1) [0x0020, 1B] The unique identifier of the consumer instance provided by end user. +-- Topics []TxnOffsetCommitRequestTopic = 1 element [0x0021, 22B] Each topic that we want to commit offsets for. | +-- length uvarint = 2 (compact, n+1) [0x0021, 1B] one sample element follows | +-- TxnOffsetCommitRequestTopic[0] TxnOffsetCommitRequestTopic = struct [0x0022, 21B] | +-- Name string = "" (compact, len+1=1) [0x0022, 1B] The topic name. | +-- Partitions []TxnOffsetCommitRequestPartition = 1 element [0x0023, 19B] The partitions inside the topic that we want to commit offsets for. | | +-- length uvarint = 2 (compact, n+1) [0x0023, 1B] one sample element follows | | +-- TxnOffsetCommitRequestPartition[0] TxnOffsetCommitRequestPartition = struct [0x0024, 18B] | | +-- PartitionIndex int32 = 0 [0x0024, 4B] The index of the partition within the topic. | | +-- CommittedOffset int64 = 0 [0x0028, 8B] The message offset to be committed. | | +-- CommittedLeaderEpoch int32 = 0 [0x0030, 4B] The leader epoch of the last consumed record. | | +-- CommittedMetadata string = "" (compact, len+1=1) [0x0034, 1B] Any associated metadata the client wants to keep. | | +-- tagged_fields uvarint = 0 [0x0035, 1B] number of tagged fields in this struct | +-- tagged_fields uvarint = 0 [0x0036, 1B] number of tagged fields in this struct +-- tagged_fields uvarint = 0 [0x0037, 1B] number of tagged fields in this struct
kafka message schema (.json)
{ "apiKey": 28, "type": "request", "listeners": ["broker"], "name": "TxnOffsetCommitRequest", // Version 1 is the same as version 0. // // Version 2 adds the committed leader epoch. // // Version 3 adds the member.id, group.instance.id and generation.id. // // Version 4 adds support for new error code TRANSACTION_ABORTABLE (KIP-890). // // Version 5 is the same as version 4 (KIP-890). Note when TxnOffsetCommit requests are used in transaction, if // transaction V2 (KIP_890 part 2) is enabled, the TxnOffsetCommit request will also include the function for a // AddOffsetsToTxn call. If V2 is disabled, the client can't use TxnOffsetCommit request version higher than 4 within // a transaction. "validVersions": "0-5", "flexibleVersions": "3+", "fields": [ { "name": "TransactionalId", "type": "string", "versions": "0+", "entityType": "transactionalId", "about": "The ID of the transaction." }, { "name": "GroupId", "type": "string", "versions": "0+", "entityType": "groupId", "about": "The ID of the group." }, { "name": "ProducerId", "type": "int64", "versions": "0+", "entityType": "producerId", "about": "The current producer ID in use by the transactional ID." }, { "name": "ProducerEpoch", "type": "int16", "versions": "0+", "about": "The current epoch associated with the producer ID." }, { "name": "GenerationId", "type": "int32", "versions": "3+", "default": "-1", "about": "The generation of the consumer." }, { "name": "MemberId", "type": "string", "versions": "3+", "default": "", "about": "The member ID assigned by the group coordinator." }, { "name": "GroupInstanceId", "type": "string", "versions": "3+", "nullableVersions": "3+", "default": "null", "about": "The unique identifier of the consumer instance provided by end user." }, { "name": "Topics", "type" : "[]TxnOffsetCommitRequestTopic", "versions": "0+", "about": "Each topic that we want to commit offsets for.", "fields": [ { "name": "Name", "type": "string", "versions": "0+", "entityType": "topicName", "about": "The topic name." }, { "name": "Partitions", "type": "[]TxnOffsetCommitRequestPartition", "versions": "0+", "about": "The partitions inside the topic that we want to commit offsets for.", "fields": [ { "name": "PartitionIndex", "type": "int32", "versions": "0+", "about": "The index of the partition within the topic." }, { "name": "CommittedOffset", "type": "int64", "versions": "0+", "about": "The message offset to be committed." }, { "name": "CommittedLeaderEpoch", "type": "int32", "versions": "2+", "default": "-1", "ignorable": true, "about": "The leader epoch of the last consumed record." }, { "name": "CommittedMetadata", "type": "string", "versions": "0+", "nullableVersions": "0+", "about": "Any associated metadata the client wants to keep." } ]} ]} ] }
Response
TxnOffsetCommitResponse v5, 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
TxnOffsetCommitResponse message v5 [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 +-- TxnOffsetCommitResponse struct [0x0009, 16B] message body, version 5 +-- ThrottleTimeMs int32 = 0 [0x0009, 4B] The duration in milliseconds for which the request was throttled due to a q... +-- Topics []TxnOffsetCommitResponseTopic = 1 element [0x000d, 11B] The responses for each topic. | +-- length uvarint = 2 (compact, n+1) [0x000d, 1B] one sample element follows | +-- TxnOffsetCommitResponseTopic[0] TxnOffsetCommitResponseTopic = struct [0x000e, 10B] | +-- Name string = "" (compact, len+1=1) [0x000e, 1B] The topic name. | +-- Partitions []TxnOffsetCommitResponsePartition = 1 element [0x000f, 8B] The responses for each partition in the topic. | | +-- length uvarint = 2 (compact, n+1) [0x000f, 1B] one sample element follows | | +-- TxnOffsetCommitResponsePartition[0] TxnOffsetCommitResponsePartition = 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": 28, "type": "response", "name": "TxnOffsetCommitResponse", // Starting in version 1, on quota violation, brokers send out responses before throttling. // // Version 2 is the same as version 1. // // Version 3 adds illegal generation, fenced instance id, and unknown member id errors. // // Version 4 adds support for new error code TRANSACTION_ABORTABLE (KIP-890). // // Version 5 is the same with version 3 (KIP-890). "validVersions": "0-5", "flexibleVersions": "3+", "fields": [ { "name": "ThrottleTimeMs", "type": "int32", "versions": "0+", "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": "[]TxnOffsetCommitResponseTopic", "versions": "0+", "about": "The responses for each topic.", "fields": [ { "name": "Name", "type": "string", "versions": "0+", "entityType": "topicName", "about": "The topic name." }, { "name": "Partitions", "type": "[]TxnOffsetCommitResponsePartition", "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." } ]} ]} ] }