I am using @StreamListener
to consume the Kafka
message.
I have set autoCommitOffset
to false
and autoCommitOnError
to false
.
I am sending all failed message to DLQ topic as well for maxAttempt for failure. I have a question while testing the changes.
What will happen if I am not acknowledging the consumed message and also not throwing any error ? Will Kafka send the message automatically after sometime ?
when i throw error, replay kicks in and it does retry till my maxAttempt configuration and the failed message goes to DLQ topic.
Let me know if Kafka support retry if the consumer not throwing any error and not acknowledging the message.
What will happen if I am not acknowledging the consumed message and also not throwing any error ? Will Kafka send the message automatically after sometime ?
No; not unless you process no further messages, and even then, you will only get a redelivery after you restart the application.
Kafka doesn't "acknowledge" discrete messages; it just stores the last processed offset within a partition.
One more question. When using DLQ topic, Is there is any way to acknowledge the messages that are sent to DLQ topic.. Currently the message sent to DLQ topic is not acknowledged at producer end so duplicate messages are present (Consumer topic and DLQ topic)
See stackoverflow.com/help/someone-answers We recently added a similar feature (ack DLQ'd messsages with manual acks) to the rabbit binder. It's less of an issue with Kafka since the next successfully processed message for the partition will have its offset committed (presumably) by the listener code; this effectively commits the offset for the failed record. If you think the binder should ack DLQ'd messages, open an issue in GitHub.