spring-kafka icon indicating copy to clipboard operation
spring-kafka copied to clipboard

Add an option to only commit consumer offsets for records that are not filtered out using RecordFilterStrategy

Open geertvb opened this issue 1 year ago • 2 comments
trafficstars

Expected Behavior

When using a RecordFilterStrategy in combination with an AckMode like RECORD, only the consumer offsets of the records that have been handled, should be committed.

Suggestion: Add a new AckMode = RECORD_FILTERED that commits the offset only when a record is not filtered out.

Current Behavior

When using ack-mode: RECORD, the offset of every record is committed to Kafka even if it was filtered out.

Context

The synchronous commit of consumer record offset is an expensive operation. It slows down record consumption unnecessarily in case the consumer is only interested in a small percentage of the records and still wants every record that is processed to be committed.

geertvb avatar Oct 18 '24 10:10 geertvb