0

I am using following script to read data from kafka -

from kafka import KafkaConsumer
from json import loads
import json

consumer = KafkaConsumer('topicname',bootstrap_servers=['brokerip'],enable_auto_commit=True)
 
 for message in consumer:
     message = message.value
     print(message)

When i first ran the code it was working, but now it's not printing anything. Nothing is changed in code. Any reason for why its happening?

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245

1 Answers1

0

When i first ran the code it was working

You've committed the messages for your consumer group (enable_auto_commit=True), and there are no messages actively being produced.

If you want to repeat the messages, you need to reset the consumer group or use a new one

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245