This project contains APIs where Producer publish (send) message and Consumer subscribe to the topic to subscribe (read) message.
Below defined Cli commands in step1, and step2 are mandatory when using kafka.
It is an example where producer is sending data in the form of Json to the topic and consumer is consuming that data from topic.
json data -> Weather
topic name -> weather
partition -> default
It is an example where producer is sending data in the form of Json to the topic and consumer is consuming that data from topic. Topic is divided into 3 partitions and Consumer group having 1 group with groupId.
json data -> Post
topic name -> post
partition -> 3 (1 , 2 , 3)
groupId -> group1
It is a simple example where producer is sending data in the form of String to the topic and consumer is consuming that data from topic.
data -> String
topic name -> topic
partition -> default
$ bin/zookeeper-server-start.sh config/zookeeper.properties
$ bin/kafka-server-start.sh config/server.properties
$ bin/kafka-topics.sh --create --topic <topic name> --bootstrap-server localhost:9092
$ bin/kafka-topics.sh --list --bootstrap-server localhost:9092
bin/kafka-console-producer.sh --topic <topic name> --bootstrap-server localhost:9092
$ bin/kafka-console-consumer.sh --topic <topic name> --from-beginning --bootstrap-server localhost:9092