cd standalone
mvn -q clean package
# Run (make sure it compiles the generated sources)
mvn -q -DskipTests exec:java -Dexec.mainClass=com.codingkiddo.avro.AvroDemo
# or: java -cp target/classes:$(dependency:list -DincludeScope=runtime) com.codingkiddo.avro.AvroDemo
This writes user.avro
and reads it back.
Start infra (Kafka in KRaft mode + Schema Registry):
cd spring-boot-kafka-avro
docker compose up -d
Then run the app:
mvn -q spring-boot:run
Produce a message:
curl -X POST http://localhost:8080/api/users -H "Content-Type: application/json" -d '{"id":1,"name":"Vinod Kumar","email":"vinod@codingkiddo.com"}'
Watch the logs for the consumer output.
Topic: users-avro
If you prefer Confluent CLI or kcat, you can inspect topics and schema at http://localhost:8081
.