-2

like :

topic_name = "auto-remediation"
address = "sape-zookeeper-1"

I need to remove hard coded values and pass the variable here :

consumer = KafkaConsumer(b'auto-remediation', bootstrap_servers='sape-zookeeper-1:9092')   
Thomas Dussaut
  • 728
  • 1
  • 7
  • 20

1 Answers1

1

Nothing is hardcoded in kafka-python consumer. You can replace any parameter with a variable. Just make sure that the variables are initialized and have correct string in them before you create client object like:

topic_name = "auto-remediation"

address = "sape-zookeeper-1"

consumer = KafkaConsumer(topic_name, bootstrap_servers=address)

Community
  • 1
  • 1
farazmateen
  • 157
  • 9