Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mukul273/springboot-kafka
Sprint boot with Apache kafka integration - Consumer and Producer
https://github.com/mukul273/springboot-kafka
apache-kafka kafka kafka-consumer kafka-producer spring-boot
Last synced: about 1 month ago
JSON representation
Sprint boot with Apache kafka integration - Consumer and Producer
- Host: GitHub
- URL: https://github.com/mukul273/springboot-kafka
- Owner: mukul273
- Created: 2018-09-01T15:29:29.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-09-08T16:04:08.000Z (over 6 years ago)
- Last Synced: 2024-11-05T23:12:06.705Z (3 months ago)
- Topics: apache-kafka, kafka, kafka-consumer, kafka-producer, spring-boot
- Language: Java
- Size: 49.8 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Welcome to Apache Kafka and Spring Boot Integration for producer as well as consumer.
Please visit https://kafka.apache.org/quickstart for running the instance of kafka and zookeeper.
In case if you are not able to get to the URl then below are the details:
1. To start the zookeeper
bin/zookeeper-server-start.sh config/zookeeper.properties2. to start the kafka cluster server
bin/kafka-server-start.sh config/server.properties3. to manually create a new topic
bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test (replace test with your topic name)4. to list the topics
bin/kafka-topics.sh --list --zookeeper localhost:2181 (This will display topics list)5. to send a msg using producer
bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test(replace test with your topic name)6. to see the consumer consuming the message
bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning(replace test with your topic name)7. Remember to read about the group(s) in kafka, very useful information
https://cwiki.apache.org/confluence/display/KAFKA/Consumer+Group+Example8. To delete the msgs from producer
seq 0 | ./bin/kafka-console-producer.sh --broker-list localhost:9092 --topic Kafka_Example_json
replace the number after seq to delete those number of msgs. Msgs after that number will be retained. Before that number will be deleted from queue.My code uses lombok to avoid biler plate code.
There is active information in the code for your information.
Enjoy !!!