Skip to content

In AckMode MANUAL_IMMEDIATE, is acknowledgment.acknowledge() optional ? #2519

Answered by garyrussell
coderbunty asked this question in Q&A
Discussion options

You must be logged in to vote

It is not "optional", calling acknowledge() commits the offset; if there are no more records and you restart the consumer, the record will not be redelivered.

Conversely, if you exit without acknowledging, the offset won't be committed and, if there are no records after this one, and you restart the consumer, the record will be redelivered.

Kafka maintains two pointers, the current position and the committed offset. Each poll returns record(s) from the current position. When a consumer starts, the current position is set to the committed offset (if there is one).

It might "appear" to be optional because, if there are more records (successfully processed) after the one you failed to acknow…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@garyrussell
Comment options

@coderbunty
Comment options

Answer selected by coderbunty
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants