kafka-python
kafka-python copied to clipboard
Is there a way to log after the consumer has not received a message for X seconds?
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")