Reputation: 811
I am developing a push notification that sends many messages to clients. Messages are published into topics and Subcribers read message from the same topic. In case of errors right after reading message from topic offset is incremented and even though I could not send message my Subscriber needs to read the next message and send it. By errors I mean the server being down or something serious.
How can I read messages with acknowledgements?
Upvotes: 1
Views: 5542
Reputation: 224
I am not sure I undestand what you mean by
In case of errors right after reading message from topic offset is incremented and even though I could not send message my Subscriber needs to read the next message and send it
What I understood is that you want to manage how your consumers handle acknowledgements (commits to the _consumer_offsets).
So Kafka allows consumers to track their position (offset) in each partition by producing a message to Kafka in the __consumer_offsets topic.
3 options are available :
So basically, you can let commits be handled automatically. Commit synchronously and wait for the broker's ack or commit asynchronously with a callback.
Hope this answers your question.
Best regards.
Upvotes: 6