How to check if topic Kafka is purged

161 Views Asked by At

I want to check if my topic is empty after changing a retention.ms to 100ms. I try to consume from my topic like this :

    consumer_kafka = KafkaConsumer(topic, bootstrap_servers=bootstrap_servers, auto_offset_reset='latest',
                               consumer_timeout_ms=10000)
    for message in consumer_kafka:
      if message is None:
        return True
      else:
        return False

If return True (topic purged) so i send my json files. But this method return None. Can anyone help me ?.

0

There are 0 best solutions below