The project was made to test the basic functionality of Kafka along with Avro schema based on Java 7 and Spring MVC (without Spring Boot)
- Set in the project or install on your computer Java 7
- Kafka
- Zookeeper
- Schema Registry (Confluent Platform)
- Optional: Schema Registry UI
- Start the services one by one using standard settings using the following commands:
bin/zookeeper-server-start.sh config/zookeeper.properties
bin/kafka-server-start.sh config/server.properties
bin/schema-registry-start etc/schema-registry/schema-registry.properties
- Generate classes based on schemas located in
/resources/avro
folder using next command in terminal from project root
mvn generate-sources
- Run
com.kaf.bootless.ConsumerMain
andcom.kaf.bootless.ProducerMain
- Get subjects
curl --location 'http://localhost:8081/subjects'
- Get schemas
curl --location 'http://localhost:8081/schemas'
- Register new Schema
curl --location 'http://localhost:8081/subjects/kafka_topic-value/versions' \
--header 'Content-Type: application/vnd.schemaregistry.v1+json' \
--data '{"schema": "{\"type\": \"record\",\"namespace\": \"com.kaf.bootless\",\"name\": \"User\",\"fields\": [{\"name\": \"id\",\"type\": \"int\"},{\"name\": \"name\",\"type\":\"string\"}]}"}'
- Delete schema
curl --location --request DELETE 'http://localhost:8081/subjects/kafka_topic-value'