Issue
I have a Kafka consumer running continuously as a service . I've noticed it only runs for a certain period of time during the day. Instead of keeping it continuously running I want to set some kind of polling timeout for the consumer.
If the consumer doesn't consumes anything/idle for 10mins then I want to shut down the service. Is there some kind of polling timeout and signaling mechanism such as this in Kafka that I can use ?
Solution
See ListenerContainerIdleEvent
and respective container property and its docs: https://docs.spring.io/spring-kafka/docs/current/reference/html/#idleEventInterval
Answered By - Artem Bilan
Answer Checked By - Mary Flores (JavaFixing Volunteer)