Reputation: 119
Suppose that kafka message producer send an event message to a topic. And then a consumer process this event message. However, this consumer process it throw exception because business error, so he want to let the message producer know it and resent again.
Are there any solution?
Upvotes: 1
Views: 1739
Reputation: 191738
You should, generally, not create such coupling between producers and consumers.
If a consumer fails to read a message then it ideally shouldn't commit that offset. If the record didn't expire in Kafka, then there's no need for the producer to send anything as data is still in the broker, so having the consumer application be restarted will attempt to read the failed offsets again.
Upvotes: 2
Reputation: 490
If you want it to never miss a message but might duplicate the occasional message, you can use delivery semantic "at-least-once".
Upvotes: 0