Annie Chandolu |
Alekhya Jaddu |
Swaroop Reddy |
Harika Kulkarni |
Hello! I have used the random funtion to generate a ssentence which displays a date and it's day. It may or may not be the exact day.
I have used the following commands to run:
- Start Zookeeper in your kafka folder on C drive.
.\bin\windows\zookeeper-server-start.bat .\config\zookeeper.properties
- Start Kafka in the same folder as above.
.\bin\windows\kafka-server-start.bat .\config\server.properties
- Creat a new topic and list all of them in the same folder. I have created a new topic called annies-part2-messages.
.\bin\windows\kafka-topics.bat --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --create --topic annies-part2-messages
.\bin\windows\kafka-topics.bat --zookeeper localhost:2181 --list
- Then open your code folder and run the MVN command to compile the code.
mvn clean compile assembly:single
- Once the build is complete, start the Consumer using your artifact ID, group ID and topic name.
java -cp target/kafka-java-app-group-1.0-SNAPSHOT-jar-with-dependencies.jar nwmsu.bigdata.kafkajava.sec01.group02.Consumer annies-part2-messages group02
- Then start the Producer in the same folder.
java -cp target/kafka-java-app-group-1.0-SNAPSHOT-jar-with-dependencies.jar nwmsu.bigdata.kafkajava.sec01.group02.ProducerByAnnie annies-part2-messages
Voila! Your app will run!
For my custom producer package I have used the days of week and type of weather. The messages which will be displayed are days of the week and the type of weather on that day, joined by a verb.
-
Open PowerShell in C:\kafka_2.13-2.7.0 folder.
-
Use a different PowerShell window for each process.
Window 1 - Run Zookeeper Service (keep window open)
.\bin\windows\zookeeper-server-start.bat .\config\zookeeper.properties
Window 2 - Run Kafka Service (keep window open)
.\bin\windows\kafka-server-start.bat .\config\server.properties
Window 3 - Create your topic name
.\bin\windows\kafka-topics.bat --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --create --topic alex-kafka
Open PowerShell as Administrator in your root project folder
mvn clean compile assembly:single
java -cp target/kafka-java-app-group-1.0-SNAPSHOT-jar-with-dependencies.jar nwmsu.bigdata.kafkajava.sec01.group02.ProducerByAlex alex-kafka
java -cp target/kafka-java-app-group-1.0-SNAPSHOT-jar-with-dependencies.jar nwmsu.bigdata.kafkajava.sec01.group02.Consumer alex-kafka group02
I have randomly generated the lyrics of the song "My Life is going on" by Cecilia Krull for my custom producer package.
Window 1 - Run Zookeeper service
.\bin\windows\zookeeper-server-start.bat .\config\zookeeper.properties
Window 2 - Run Kafka Service
.\bin\windows\kafka-server-start.bat .\config\server.properties
Window 3 - Create your topic name
.\bin\windows\kafka-topics.bat --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --create --topic sunny-messages
Window 4 - Compile the jar file
mvn clean compile assembly:single
Window 5 - Start Producer
java -cp target/kafka-java-app-group-1.0-SNAPSHOT-jar-with-dependencies.jar nwmsu.bigdata.kafkajava.sec01.group02.ProducerBySunny sunny-messages
Window 6 - Start Consumer
java -cp target/kafka-java-app-group-1.0-SNAPSHOT-jar-with-dependencies.jar nwmsu.bigdata.kafkajava.sec01.group02.Consumer sunny-messages group02
I have generated a random sentencen using Articles,noun,verb,preposition.
Step1: In Kafka Folder,open powershell as Admin and start Zookeeper service as below:
.\bin\windows\zookeeper-server-start.bat .\config\zookeeper.properties
Step2: In Kafka Folder,open another powershell as Admin and start Kafka service as below:
.\bin\windows\kafka-server-start.bat .\config\server.properties
Step3: In Kafka Folder,open another powershell as Admin and create a topic
.\bin\windows\kafka-topics.bat --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --create --topic random-text
Step4: In root project folder,open Powershell as admin and compile the code using the below command.
mvn clean compile assembly:single
Step5: In the same root project folder,start the Consumer using another terminal
java -cp target/kafka-java-app-group-1.0-SNAPSHOT-jar-with-dependencies.jar nwmsu.bigdata.kafkajava.sec01.group02.Consumer random-text group02
Step6: In the same root project folder,start the Producer using another terminal
java -cp target/kafka-java-app-group-1.0-SNAPSHOT-jar-with-dependencies.jar nwmsu.bigdata.kafkajava.sec01.group02.ProducerByHarika random-text