Support committing offsets in transaction
See original GitHub issueOverview
Kafka transactions provide support for the “consume-transform-produce loop” by allowing transactional producers to commit offsets for their recently consumed messages. This allows a client to ensure that offsets are committed for consumed messages only if the transaction is committed.
The spec recommends we enable support by adding a method “sendOffsets” (sendOffsetsToTransaction
) to the transactional producer. This method will accept a data structure mapping topic-partitions to offsets, then perform the requests AddOffsetsToTxnRequest
and subsequently TxnOffsetCommit
.
Currently the consumer will automatically commit offsets when reading messages. We will need to update the API to allow users to disable this option, so that they may send the offsets themselves via the producer’s new sendOffsetsToTransaction
method.
Would love to hear your thoughts on how best to update the consumer to accommodate this need @tulios @Nevon
Tasks
- Add method
sendOffsetsToTransaction
- Update consumer to allow disabling auto committing
- Keep offsetManager in sync with sent offsets
Links
- consume-transform-produce loop (steps 4.3 & 4.4)
- Java Implementation
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (7 by maintainers)
@ianwsperber that was also my proposal, go for it!
Closing this as per #232