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.
Wire Diagram
Request Header
message_size
int32 · 4B
api_key
int16 · 2B
api_version
int16 · 2B
correlation_id
int32 · 4B
client_id
string
TxnOffsetCommitRequest v0
TransactionalId
string
GroupId
string
ProducerId
int64 · 8B
ProducerEpoch
int16 · 2B
Name
string
PartitionIndex
int32 · 4B
CommittedOffset
int64 · 8B
CommittedMetadata?
string
Schema & Example
Schema { "TransactionalId": string, "GroupId": string, "ProducerId": int64, "ProducerEpoch": int16, "Topics": [{ "Name": string, "Partitions": [{ "PartitionIndex": int32, "CommittedOffset": int64, "CommittedMetadata": string? }] }] }
Example { "TransactionalId": "tx-orders-001", "GroupId": "order-processors", "ProducerId": 0, "ProducerEpoch": 12, "Topics": [{ "Name": "orders", "Partitions": [{ "PartitionIndex": 3, "CommittedOffset": 150382, "CommittedMetadata": "" }] }] }