I want to tell Kafka when my consumer has successfully processed a record so I have turned auto-commit off by settting enable.auto.commit
to false. I have two messages on a topic I am subscribed to at offset zero and one and have created a consumer so that each call to poll
will return at most one record (by setting max.poll.records
to 1).
I now call consumer.poll(5000)
and receive the first message but I do not acknowledge it; I do not call commitSync
or commitAsync
. If I now call consumer.poll(5000)
again, using the same consumer, I expect to get the exact same message I just read but, instead, I receive the second message.
How do I get consumer.poll
to keep handing out the same message until I explicitly acknowledge it?