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.
| Version | Kafka | Changes |
|---|---|---|
| TxnOffsetCommitRequest | ||
| v0 | 2.2 | + TransactionalId string+ GroupId string+ ProducerId int64+ ProducerEpoch int16+ Topics []TxnOffsetCommitRequestTopic+ Name string+ Partitions []TxnOffsetCommitRequestPartition+ PartitionIndex int32+ CommittedOffset int64+ CommittedMetadata string |
| v1 | 2.2 | is the same as version 0. |
| v2 | 2.2 | + CommittedLeaderEpoch int32adds the committed leader epoch. |
| v3 | 2.5 | + GenerationId int32+ MemberId string+ GroupInstanceId string~ Flexible encoding enabled FLEXIBLE adds the member.id, group.instance.id and generation.id. |
| v4 | 3.8 | adds support for new error code TRANSACTION_ABORTABLE (KIP-890). |
| v5 | 4.0 | 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. |
| TxnOffsetCommitResponse | ||
| v0 | 2.2 | + ThrottleTimeMs int32+ Topics []TxnOffsetCommitResponseTopic+ Name string+ Partitions []TxnOffsetCommitResponsePartition+ PartitionIndex int32+ ErrorCode int16 |
| v1 | 2.2 | on quota violation, brokers send out responses before throttling. |
| v2 | 2.2 | is the same as version 1. |
| v3 | 2.5 | ~ Flexible encoding enabled FLEXIBLE adds illegal generation, fenced instance id, and unknown member id errors. |
| v4 | 3.8 | adds support for new error code TRANSACTION_ABORTABLE (KIP-890). |
| v5 | 4.0 | is the same with version 3 (KIP-890). |