https://github.com/dipjul/springboot-kafka
https://github.com/dipjul/springboot-kafka
Last synced: 7 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/dipjul/springboot-kafka
- Owner: dipjul
- Created: 2022-10-27T18:24:55.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-10-27T18:42:06.000Z (about 3 years ago)
- Last Synced: 2025-01-07T21:11:37.095Z (about 1 year ago)
- Language: Java
- Size: 60.5 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Kafka on Springboot Demo application
**Apache Kafka Setup**
- Download the binary & extract it
- Go inside the kafka folder
- Execute `.\bin\windows\zookeeper-server-start.bat .\config\zookeeper.properties` on cmd prompt for zookeeper
- If you get some error related to input size then put the kafka folder in your C drive
- Execute `.\bin\windows\kafka-server-start.bat .\config\server.properties` on a different cmd prompt for kafka brokers
- Optional:
- Execute `.\bin\windows\kafka-console-consumer.bat --topic sampleTopic --from-beginning --bootstrap-server localhost:9092` on a different cmd prompt for kafka consumer
- Execute `.\bin\windows\kafka-console-consumer.bat --topic sampleJsonTopic --from-beginning --bootstrap-server localhost:9092` on a different cmd prompt for kafka consumer
**REST API**
- **GET** `localhost:8080/api/v1/kafka/message/publish`
- *RequestParam*: message
- Eg. `localhost:8080/api/v1/kafka/message/publish?message=hello%20world`
- **POST** `localhost:8080/api/v1/kafka/jsonMessage/publish`
- *RequestBody*: User
- Eg. `localhost:8080/api/v1/kafka/jsonMessage/publish`
- Body: {
"id" : 1,
"firstName" : "deep",
"lastName" : "rman"
}