I have to create a kafka consumer as a part of my application. But because of the use case I have to poll manually. Because whenever the poll is not returning any messages from topic i have to take certain steps. This i am not able to do using spring kafka as it only calls when a message is received.
Is there any way to run this consumer when the application starts? I was thinking of using CommandLineRunner but it doesn't seem to be clean(Are there any problems with this way of starting an infinite loop in a Spring Boot application?)
Or if i use spring kafka , is there any way to know if a particular partition or topic has not events
I could think of starting this in a separate thread or using CommandLineRunner. Any suggestions for a better solution?