3. KAFKA : Sample Program1
Exaple 1:
Producer - send million message (Java program)Consumer - receive million message (Java program)
https://www.youtube.com/watch?v=1Og9n9FJteM
########################################################################
STEP1:
https://git-scm.com/download/win
-> Git-2.24.1.2-64-bit.exe
-> Set path to -> C:\Program Files\Git\bin
STEP2:
Get sample kafka program from GIT:
https://github.com/mapr-demos/kafka-sample-programs
-> cd kafka/SampleProgram/
-> git clone https://github.com/mapr-demos/kafka-sample-programs.git
-> //It creates folder called kafka/SampleProgram/kafka--sample-programs
STEP3:
Apache kafka download - kafka.apache.org/downloads.html
-> Scala 2.13 - kafka_2.13-2.4.0.tgz
-> http://apachemirror.wuchna.com/kafka/2.4.0/kafka_2.13-2.4.0.tgz
-> Unzip kafka_2.13-2.4.0.tgz
-> cd kafka_2.13-2.4.0/
-> START ZOOKEEPER:
$ .\bin\zookeeper-server-start.sh .\config\zookeeper.properties
-> START KAFKA SERVER:
$ .\bin\kafka-server-start.sh .\config\server.properties &
-> CREATE TOPIC:
$ bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic fast-messages
$ bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic summary-markers
-> Check list of topics available in kafka serrver
$ bin/kafka-topics.sh --list --zookeeper localhost:2181
-> BUILD PRODUCER/CONSUMER program
$ cd ..
$ mvn package //it will compile and create /target foler
-> Run PRODUCER program
$ target/kafka-example producer
-> Run CONSUMER program
$ target/kafka-example consumer