Skip to content

al-potemkin/kafka-spring-mvc-bootless

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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)

To start the project you need to have:

  1. 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
  1. Generate classes based on schemas located in /resources/avro folder using next command in terminal from project root
mvn generate-sources
  1. Run com.kaf.bootless.ConsumerMain and com.kaf.bootless.ProducerMain

Useful requests for working with Schema Registry:

  • 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'

About

Bundle testing project: Kafka, Avro Schema, Java 7, Spring MVC without using Spring Boot

Topics

Resources

Stars

Watchers

Forks

Languages