Just a simple Kafka Producer and Consumer written in Java 11 with Spring Boot. This is just for study purposes. I've made this just for fun! =)
Everything you'll need is containerized on Docker. So you can test it without too much of a hassle (containers s2).
By default this application will listen on port 8080.
There's a producer sending messages to the kafka broker on topic myTopic.
There's a consumer listening to events from topic myTopic and consuming it on Group my-group.
You can access this features via RESTfull API's.
These instructions will get you a copy of the project up and running on your local machine.
* JDK 11 or later
* Maven 2.2.7 or later
* Docker 19.0 or later
This project uses a Makefile which makes it easier for you to execute the main tasks.
make compile
make test
make package
make run
make deploy
You can publish an event to Kafka by using the POST method.
curl --location --request POST 'localhost:8080/api/kafka' \
--header 'Content-Type: application/json' \
--data-raw '{
"title": "Amazing Title",
"message": "Testing like a boss"
}'
You can access the events consumed using the GET method.
curl --location --request GET 'localhost:8080/api/kafka'
You can access an interactive API documentation for this whole project built with Swagger by accessing:
http://localhost:8080/swagger-ui.html
There you can see all the endpoints available, their usage, responses and even try them for yourself.
- Java 11 - The language most people love to hate
- Maven - Dependency Management
- SpringBoot - Framework used
- Spring Initializr - Bootstrap for SpringBoot applications
- Docker - Containers made simple
- Swagger - Documentation and Design Tools for Teams
- Kafka - A distributed streaming platform