问题
I use Spring KafKa anf I set ackMode to MANUAL_IMMEDIATE
props.setAckMode(AbstractMessageListenerContainer.AckMode.MANUAL_IMMEDIATE);
the scenario is that for some reason my app could not acknowledge (acknowledgment.acknowledge()
) and just miss it without exception.
1- How can I set consumer retry for missed message 2- How configure to call a function after max retry count that I configured reached
回答1:
See the documentation about SeekToCurrentErrorHandlers.
When the listener throws an exception, the error handler will perform the necessary seeks and re-fetch the record. You can set the number of attempts before giving up.
There is also a DeadLetterPublishingRecoverer which can be used to send the failed record to another topic.
来源:https://stackoverflow.com/questions/54530309/kafka-manual-ackmode-manual-immediate-what-if-not-acknowledge