We are gonna make a kafka producer and send them to kafka console consumer. Then, we send the results to a csv file
You can find the file results.csv in your kafka file.
- Download Kafka and Zookeeper
- Start Zookeeper
- Start Kafka
- Create a topic
- Run Kafka-Console-Consumer
- Writing output on a CSV file
ubuntu@ubuntu-pc:~/kafka_2.12-2.0.0$ bin/zookeeper-server-start.sh config/zookeeper.properties
ubuntu@ubuntu-pc:~/kafka_2.12-2.0.0$ kafka-server-start.sh config/server.properties
ubuntu@ubuntu-pc:~/kafka_2.12-2.0.0$ kafka-server-start.sh config/server.properties
ubuntu@ubuntu-pc:~/kafka_2.12-2.0.0$ bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test
Created topic "test".
ubuntu@ubuntu-pc:~/kafka_2.12-2.0.0$ kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic topicNew1
ubuntu@ubuntu-pc:~/kafka_2.12-2.0.0$ kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic topicNew1 > results.csv