The producer in this case uses "localhost:9092" boostrap server for kafka.
Follow below steps and consume messages over kafka topic.
-
Start the zookeeper server: C:\kafka_2.12-2.5.0\bin\windows>zookeeper-server-start.bat ../../config/zookeeper.properties
-
Start the kafka server C:\kafka_2.12-2.5.0\bin\windows> kafka-server-start.sh ../../config/server.properties
-
Start the consumer to listen on localhost:9092 C:\kafka_2.12-2.5.0\bin\windows>kafka-console-consumer.bat --bootstrap-server localhost:9092 --topic first_topic
-
Run the java class ProducerDemo from your intellij or any other IDE.
-
Verify the message send "hello-world" in this case.
C:\kafka_2.12-2.5.0\bin\windows>kafka-console-consumer.bat --bootstrap-server localhost:9092 --topic first_topic hello-world