We are trying to solve an edge case scenario, in spring boot kafka listener:
@KafkaListener(topics="topicName", groupId="consumerGoupId")
public void consumeNotification(@Payload Datarequest request,
@Header(KafkaHeaders.OFFSET) Long offset,
@Header(KafkaHeaders.RECEIVED_PARTITION_ID)Integer partitionId)
{
processRequest(request);
}
Now for some reason when processRequest is going on, my spring boot app gets Shutdown,the offset doesn't get committed and when it is up,the listener picks up the same message for processing again.
My use case is : Is there any way to know Listener has got this message as part of Retry?
Because since process request was stopped in between due to app Crash, if the same message has picked up by listener again, I have to write some logic in processRequest to start processing from where it stopped.