Warm tip: This article is reproduced from stackoverflow.com, please click
apache-kafka spring-kafka stream consumer

Unacknowledged message with no error

发布于 2020-04-10 16:16:35

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.

Questioner
JPGS
Viewed
66
Gary Russell 2020-02-03 00:33

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.