conduktor.io ↗

Kafka TxnOffsetCommit Request Wire Format v5 — Binary Protocol Layout

What is TxnOffsetCommit?

Stages an offset commit as part of a transaction. The offsets aren't visible to other consumers until the transaction commits. If the transaction aborts, the offsets roll back and the consumer will reprocess those records.

Related Errors

COORDINATOR_LOAD_IN_PROGRESS · COORDINATOR_NOT_AVAILABLE · GROUP_AUTHORIZATION_FAILED · ILLEGAL_GENERATION · INVALID_GROUP_ID · OFFSET_METADATA_TOO_LARGE · TOPIC_AUTHORIZATION_FAILED · TRANSACTIONAL_ID_AUTHORIZATION_FAILED · UNKNOWN_TOPIC_OR_PARTITION

Wire Diagram

Request Header · flexible
message_size int32 · 4B
api_key int16 · 2B
api_version int16 · 2B
correlation_id int32 · 4B
client_id string (compact)
tagged var
TxnOffsetCommitRequest v5
TransactionalId string (compact)
GroupId string (compact)
ProducerId int64 · 8B
ProducerEpoch int16 · 2B
GenerationId int32 · 4B
MemberId string (compact)
GroupInstanceId? string (compact)
Topics array
tagged var
Name string (compact)
Partitions array
tagged var
PartitionIndex int32 · 4B
CommittedOffset int64 · 8B
CommittedLeaderEpoch int32 · 4B
CommittedMetadata? string (compact)
tagged var

Schema & Example

Schema
{
  "TransactionalId": string,
  "GroupId": string,
  "ProducerId": int64,
  "ProducerEpoch": int16,
  "GenerationId": int32,
  "MemberId": string,
  "GroupInstanceId": string?,
  "Topics": [{
      "Name": string,
      "Partitions": [{
          "PartitionIndex": int32,
          "CommittedOffset": int64,
          "CommittedLeaderEpoch": int32,
          "CommittedMetadata": string?
      }]
  }]
}
Example
{
  "TransactionalId": "tx-orders-001",
  "GroupId": "order-processors",
  "ProducerId": 0,
  "ProducerEpoch": 12,
  "GenerationId": 5,
  "MemberId": "consumer-1-abc123",
  "GroupInstanceId": null,
  "Topics": [{
      "Name": "orders",
      "Partitions": [{
          "PartitionIndex": 3,
          "CommittedOffset": 150382,
          "CommittedLeaderEpoch": 12,
          "CommittedMetadata": null
      }]
  }]
}