Main purpose of this application is to show how to setup
- local configuration for kafka infrastructure (broker, zookeeper, schema registry)
- with a topic, producer and consumer
By using /api/kafka/publish/messages endpoint we will publish messages that will be consumed by our listener.
- openjdk 17
- spring boot 3.0.6
In order to upload schema and/or generate AVRO sources after that do next:
- go to folder root/kafka and run
docker-compose up
make sure that all services are up and running - run
mvn validate
- go to http://localhost:8081/schemas and check if schema for
UserCreated
is registered - in case that you want to generate local AVRO sources (the one that we are using is already part of the repo) run
mvn generate-sources
- run the app and produce some messages via
curl -X GET http://localhost:8080/demo/api/kafka/publish/messages
- observe the logs :)
- use control center to access broker http://localhost:9021/clusters
http://localhost:8080/demo/swagger-ui/index.html