kafka-python icon indicating copy to clipboard operation
kafka-python copied to clipboard

Is there a way to log after the consumer has not received a message for X seconds?

Open cmyers009 opened this issue 3 years ago • 0 comments

I want to add logging for when the consumer does not receive a message for longer than 5 minutes. The problem is that this for loop never exits (even if there are no messages in the consumer). How do I make this loop finish once the consumer has run out of messages? I tried using the consumer_timeout_ms config option but that did not work for me.

Pardon the fact that I do not know how to properly add a code block in a GitHub comment. This is my first question I am raising on the platform. consumer=kafka.KafkaConsumer(configs) while True: for message in consumer: #Do stuff print("Kafka Queue is empty")

cmyers009 avatar Jan 13 '23 13:01 cmyers009