diff --git a/schema-registry-samples/spring-schema-registry-kafka-standalone/pom.xml b/schema-registry-samples/spring-schema-registry-kafka-standalone/pom.xml
index 10d4eee..56ec835 100644
--- a/schema-registry-samples/spring-schema-registry-kafka-standalone/pom.xml
+++ b/schema-registry-samples/spring-schema-registry-kafka-standalone/pom.xml
@@ -99,7 +99,6 @@
${project.basedir}/src/main/resources/avro
- ${project.basedir}/src/main/java/
diff --git a/schema-registry-samples/spring-schema-registry-kafka-standalone/src/main/java/com/example/Sensor.java b/schema-registry-samples/spring-schema-registry-kafka-standalone/src/main/java/com/example/Sensor.java
deleted file mode 100644
index bad63b7..0000000
--- a/schema-registry-samples/spring-schema-registry-kafka-standalone/src/main/java/com/example/Sensor.java
+++ /dev/null
@@ -1,548 +0,0 @@
-/**
- * Autogenerated by Avro
- *
- * DO NOT EDIT DIRECTLY
- */
-package com.example;
-
-import org.apache.avro.generic.GenericArray;
-import org.apache.avro.specific.SpecificData;
-import org.apache.avro.util.Utf8;
-import org.apache.avro.message.BinaryMessageEncoder;
-import org.apache.avro.message.BinaryMessageDecoder;
-import org.apache.avro.message.SchemaStore;
-
-@org.apache.avro.specific.AvroGenerated
-public class Sensor extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
- private static final long serialVersionUID = 1196898085889970034L;
- public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"Sensor\",\"namespace\":\"com.example\",\"fields\":[{\"name\":\"id\",\"type\":\"string\"},{\"name\":\"temperature\",\"type\":\"float\",\"default\":0.0},{\"name\":\"acceleration\",\"type\":\"float\",\"default\":0.0},{\"name\":\"velocity\",\"type\":\"float\",\"default\":0.0}]}");
- public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
-
- private static SpecificData MODEL$ = new SpecificData();
-
- private static final BinaryMessageEncoder ENCODER =
- new BinaryMessageEncoder(MODEL$, SCHEMA$);
-
- private static final BinaryMessageDecoder DECODER =
- new BinaryMessageDecoder(MODEL$, SCHEMA$);
-
- /**
- * Return the BinaryMessageEncoder instance used by this class.
- * @return the message encoder used by this class
- */
- public static BinaryMessageEncoder getEncoder() {
- return ENCODER;
- }
-
- /**
- * Return the BinaryMessageDecoder instance used by this class.
- * @return the message decoder used by this class
- */
- public static BinaryMessageDecoder getDecoder() {
- return DECODER;
- }
-
- /**
- * Create a new BinaryMessageDecoder instance for this class that uses the specified {@link SchemaStore}.
- * @param resolver a {@link SchemaStore} used to find schemas by fingerprint
- * @return a BinaryMessageDecoder instance for this class backed by the given SchemaStore
- */
- public static BinaryMessageDecoder createDecoder(SchemaStore resolver) {
- return new BinaryMessageDecoder(MODEL$, SCHEMA$, resolver);
- }
-
- /**
- * Serializes this Sensor to a ByteBuffer.
- * @return a buffer holding the serialized data for this instance
- * @throws java.io.IOException if this instance could not be serialized
- */
- public java.nio.ByteBuffer toByteBuffer() throws java.io.IOException {
- return ENCODER.encode(this);
- }
-
- /**
- * Deserializes a Sensor from a ByteBuffer.
- * @param b a byte buffer holding serialized data for an instance of this class
- * @return a Sensor instance decoded from the given buffer
- * @throws java.io.IOException if the given bytes could not be deserialized into an instance of this class
- */
- public static Sensor fromByteBuffer(
- java.nio.ByteBuffer b) throws java.io.IOException {
- return DECODER.decode(b);
- }
-
- private java.lang.CharSequence id;
- private float temperature;
- private float acceleration;
- private float velocity;
-
- /**
- * Default constructor. Note that this does not initialize fields
- * to their default values from the schema. If that is desired then
- * one should use newBuilder().
- */
- public Sensor() {}
-
- /**
- * All-args constructor.
- * @param id The new value for id
- * @param temperature The new value for temperature
- * @param acceleration The new value for acceleration
- * @param velocity The new value for velocity
- */
- public Sensor(java.lang.CharSequence id, java.lang.Float temperature, java.lang.Float acceleration, java.lang.Float velocity) {
- this.id = id;
- this.temperature = temperature;
- this.acceleration = acceleration;
- this.velocity = velocity;
- }
-
- public org.apache.avro.specific.SpecificData getSpecificData() { return MODEL$; }
- public org.apache.avro.Schema getSchema() { return SCHEMA$; }
- // Used by DatumWriter. Applications should not call.
- public java.lang.Object get(int field$) {
- switch (field$) {
- case 0: return id;
- case 1: return temperature;
- case 2: return acceleration;
- case 3: return velocity;
- default: throw new IndexOutOfBoundsException("Invalid index: " + field$);
- }
- }
-
- // Used by DatumReader. Applications should not call.
- @SuppressWarnings(value="unchecked")
- public void put(int field$, java.lang.Object value$) {
- switch (field$) {
- case 0: id = (java.lang.CharSequence)value$; break;
- case 1: temperature = (java.lang.Float)value$; break;
- case 2: acceleration = (java.lang.Float)value$; break;
- case 3: velocity = (java.lang.Float)value$; break;
- default: throw new IndexOutOfBoundsException("Invalid index: " + field$);
- }
- }
-
- /**
- * Gets the value of the 'id' field.
- * @return The value of the 'id' field.
- */
- public java.lang.CharSequence getId() {
- return id;
- }
-
-
- /**
- * Sets the value of the 'id' field.
- * @param value the value to set.
- */
- public void setId(java.lang.CharSequence value) {
- this.id = value;
- }
-
- /**
- * Gets the value of the 'temperature' field.
- * @return The value of the 'temperature' field.
- */
- public float getTemperature() {
- return temperature;
- }
-
-
- /**
- * Sets the value of the 'temperature' field.
- * @param value the value to set.
- */
- public void setTemperature(float value) {
- this.temperature = value;
- }
-
- /**
- * Gets the value of the 'acceleration' field.
- * @return The value of the 'acceleration' field.
- */
- public float getAcceleration() {
- return acceleration;
- }
-
-
- /**
- * Sets the value of the 'acceleration' field.
- * @param value the value to set.
- */
- public void setAcceleration(float value) {
- this.acceleration = value;
- }
-
- /**
- * Gets the value of the 'velocity' field.
- * @return The value of the 'velocity' field.
- */
- public float getVelocity() {
- return velocity;
- }
-
-
- /**
- * Sets the value of the 'velocity' field.
- * @param value the value to set.
- */
- public void setVelocity(float value) {
- this.velocity = value;
- }
-
- /**
- * Creates a new Sensor RecordBuilder.
- * @return A new Sensor RecordBuilder
- */
- public static com.example.Sensor.Builder newBuilder() {
- return new com.example.Sensor.Builder();
- }
-
- /**
- * Creates a new Sensor RecordBuilder by copying an existing Builder.
- * @param other The existing builder to copy.
- * @return A new Sensor RecordBuilder
- */
- public static com.example.Sensor.Builder newBuilder(com.example.Sensor.Builder other) {
- if (other == null) {
- return new com.example.Sensor.Builder();
- } else {
- return new com.example.Sensor.Builder(other);
- }
- }
-
- /**
- * Creates a new Sensor RecordBuilder by copying an existing Sensor instance.
- * @param other The existing instance to copy.
- * @return A new Sensor RecordBuilder
- */
- public static com.example.Sensor.Builder newBuilder(com.example.Sensor other) {
- if (other == null) {
- return new com.example.Sensor.Builder();
- } else {
- return new com.example.Sensor.Builder(other);
- }
- }
-
- /**
- * RecordBuilder for Sensor instances.
- */
- @org.apache.avro.specific.AvroGenerated
- public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase
- implements org.apache.avro.data.RecordBuilder {
-
- private java.lang.CharSequence id;
- private float temperature;
- private float acceleration;
- private float velocity;
-
- /** Creates a new Builder */
- private Builder() {
- super(SCHEMA$);
- }
-
- /**
- * Creates a Builder by copying an existing Builder.
- * @param other The existing Builder to copy.
- */
- private Builder(com.example.Sensor.Builder other) {
- super(other);
- if (isValidValue(fields()[0], other.id)) {
- this.id = data().deepCopy(fields()[0].schema(), other.id);
- fieldSetFlags()[0] = other.fieldSetFlags()[0];
- }
- if (isValidValue(fields()[1], other.temperature)) {
- this.temperature = data().deepCopy(fields()[1].schema(), other.temperature);
- fieldSetFlags()[1] = other.fieldSetFlags()[1];
- }
- if (isValidValue(fields()[2], other.acceleration)) {
- this.acceleration = data().deepCopy(fields()[2].schema(), other.acceleration);
- fieldSetFlags()[2] = other.fieldSetFlags()[2];
- }
- if (isValidValue(fields()[3], other.velocity)) {
- this.velocity = data().deepCopy(fields()[3].schema(), other.velocity);
- fieldSetFlags()[3] = other.fieldSetFlags()[3];
- }
- }
-
- /**
- * Creates a Builder by copying an existing Sensor instance
- * @param other The existing instance to copy.
- */
- private Builder(com.example.Sensor other) {
- super(SCHEMA$);
- if (isValidValue(fields()[0], other.id)) {
- this.id = data().deepCopy(fields()[0].schema(), other.id);
- fieldSetFlags()[0] = true;
- }
- if (isValidValue(fields()[1], other.temperature)) {
- this.temperature = data().deepCopy(fields()[1].schema(), other.temperature);
- fieldSetFlags()[1] = true;
- }
- if (isValidValue(fields()[2], other.acceleration)) {
- this.acceleration = data().deepCopy(fields()[2].schema(), other.acceleration);
- fieldSetFlags()[2] = true;
- }
- if (isValidValue(fields()[3], other.velocity)) {
- this.velocity = data().deepCopy(fields()[3].schema(), other.velocity);
- fieldSetFlags()[3] = true;
- }
- }
-
- /**
- * Gets the value of the 'id' field.
- * @return The value.
- */
- public java.lang.CharSequence getId() {
- return id;
- }
-
-
- /**
- * Sets the value of the 'id' field.
- * @param value The value of 'id'.
- * @return This builder.
- */
- public com.example.Sensor.Builder setId(java.lang.CharSequence value) {
- validate(fields()[0], value);
- this.id = value;
- fieldSetFlags()[0] = true;
- return this;
- }
-
- /**
- * Checks whether the 'id' field has been set.
- * @return True if the 'id' field has been set, false otherwise.
- */
- public boolean hasId() {
- return fieldSetFlags()[0];
- }
-
-
- /**
- * Clears the value of the 'id' field.
- * @return This builder.
- */
- public com.example.Sensor.Builder clearId() {
- id = null;
- fieldSetFlags()[0] = false;
- return this;
- }
-
- /**
- * Gets the value of the 'temperature' field.
- * @return The value.
- */
- public float getTemperature() {
- return temperature;
- }
-
-
- /**
- * Sets the value of the 'temperature' field.
- * @param value The value of 'temperature'.
- * @return This builder.
- */
- public com.example.Sensor.Builder setTemperature(float value) {
- validate(fields()[1], value);
- this.temperature = value;
- fieldSetFlags()[1] = true;
- return this;
- }
-
- /**
- * Checks whether the 'temperature' field has been set.
- * @return True if the 'temperature' field has been set, false otherwise.
- */
- public boolean hasTemperature() {
- return fieldSetFlags()[1];
- }
-
-
- /**
- * Clears the value of the 'temperature' field.
- * @return This builder.
- */
- public com.example.Sensor.Builder clearTemperature() {
- fieldSetFlags()[1] = false;
- return this;
- }
-
- /**
- * Gets the value of the 'acceleration' field.
- * @return The value.
- */
- public float getAcceleration() {
- return acceleration;
- }
-
-
- /**
- * Sets the value of the 'acceleration' field.
- * @param value The value of 'acceleration'.
- * @return This builder.
- */
- public com.example.Sensor.Builder setAcceleration(float value) {
- validate(fields()[2], value);
- this.acceleration = value;
- fieldSetFlags()[2] = true;
- return this;
- }
-
- /**
- * Checks whether the 'acceleration' field has been set.
- * @return True if the 'acceleration' field has been set, false otherwise.
- */
- public boolean hasAcceleration() {
- return fieldSetFlags()[2];
- }
-
-
- /**
- * Clears the value of the 'acceleration' field.
- * @return This builder.
- */
- public com.example.Sensor.Builder clearAcceleration() {
- fieldSetFlags()[2] = false;
- return this;
- }
-
- /**
- * Gets the value of the 'velocity' field.
- * @return The value.
- */
- public float getVelocity() {
- return velocity;
- }
-
-
- /**
- * Sets the value of the 'velocity' field.
- * @param value The value of 'velocity'.
- * @return This builder.
- */
- public com.example.Sensor.Builder setVelocity(float value) {
- validate(fields()[3], value);
- this.velocity = value;
- fieldSetFlags()[3] = true;
- return this;
- }
-
- /**
- * Checks whether the 'velocity' field has been set.
- * @return True if the 'velocity' field has been set, false otherwise.
- */
- public boolean hasVelocity() {
- return fieldSetFlags()[3];
- }
-
-
- /**
- * Clears the value of the 'velocity' field.
- * @return This builder.
- */
- public com.example.Sensor.Builder clearVelocity() {
- fieldSetFlags()[3] = false;
- return this;
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public Sensor build() {
- try {
- Sensor record = new Sensor();
- record.id = fieldSetFlags()[0] ? this.id : (java.lang.CharSequence) defaultValue(fields()[0]);
- record.temperature = fieldSetFlags()[1] ? this.temperature : (java.lang.Float) defaultValue(fields()[1]);
- record.acceleration = fieldSetFlags()[2] ? this.acceleration : (java.lang.Float) defaultValue(fields()[2]);
- record.velocity = fieldSetFlags()[3] ? this.velocity : (java.lang.Float) defaultValue(fields()[3]);
- return record;
- } catch (org.apache.avro.AvroMissingFieldException e) {
- throw e;
- } catch (java.lang.Exception e) {
- throw new org.apache.avro.AvroRuntimeException(e);
- }
- }
- }
-
- @SuppressWarnings("unchecked")
- private static final org.apache.avro.io.DatumWriter
- WRITER$ = (org.apache.avro.io.DatumWriter)MODEL$.createDatumWriter(SCHEMA$);
-
- @Override public void writeExternal(java.io.ObjectOutput out)
- throws java.io.IOException {
- WRITER$.write(this, SpecificData.getEncoder(out));
- }
-
- @SuppressWarnings("unchecked")
- private static final org.apache.avro.io.DatumReader
- READER$ = (org.apache.avro.io.DatumReader)MODEL$.createDatumReader(SCHEMA$);
-
- @Override public void readExternal(java.io.ObjectInput in)
- throws java.io.IOException {
- READER$.read(this, SpecificData.getDecoder(in));
- }
-
- @Override protected boolean hasCustomCoders() { return true; }
-
- @Override public void customEncode(org.apache.avro.io.Encoder out)
- throws java.io.IOException
- {
- out.writeString(this.id);
-
- out.writeFloat(this.temperature);
-
- out.writeFloat(this.acceleration);
-
- out.writeFloat(this.velocity);
-
- }
-
- @Override public void customDecode(org.apache.avro.io.ResolvingDecoder in)
- throws java.io.IOException
- {
- org.apache.avro.Schema.Field[] fieldOrder = in.readFieldOrderIfDiff();
- if (fieldOrder == null) {
- this.id = in.readString(this.id instanceof Utf8 ? (Utf8)this.id : null);
-
- this.temperature = in.readFloat();
-
- this.acceleration = in.readFloat();
-
- this.velocity = in.readFloat();
-
- } else {
- for (int i = 0; i < 4; i++) {
- switch (fieldOrder[i].pos()) {
- case 0:
- this.id = in.readString(this.id instanceof Utf8 ? (Utf8)this.id : null);
- break;
-
- case 1:
- this.temperature = in.readFloat();
- break;
-
- case 2:
- this.acceleration = in.readFloat();
- break;
-
- case 3:
- this.velocity = in.readFloat();
- break;
-
- default:
- throw new java.io.IOException("Corrupt ResolvingDecoder.");
- }
- }
- }
- }
-}
-
-
-
-
-
-
-
-
-
-
diff --git a/schema-registry-samples/spring-schema-registry-kafka-standalone/src/main/java/com/example/SchemaRegistryKafkaStandalone.java b/schema-registry-samples/spring-schema-registry-kafka-standalone/src/main/java/com/example/demo/SchemaRegistryKafkaStandalone.java
similarity index 96%
rename from schema-registry-samples/spring-schema-registry-kafka-standalone/src/main/java/com/example/SchemaRegistryKafkaStandalone.java
rename to schema-registry-samples/spring-schema-registry-kafka-standalone/src/main/java/com/example/demo/SchemaRegistryKafkaStandalone.java
index f28fbf1..26af9ab 100644
--- a/schema-registry-samples/spring-schema-registry-kafka-standalone/src/main/java/com/example/SchemaRegistryKafkaStandalone.java
+++ b/schema-registry-samples/spring-schema-registry-kafka-standalone/src/main/java/com/example/demo/SchemaRegistryKafkaStandalone.java
@@ -1,8 +1,10 @@
-package com.example;
+package com.example.demo;
import java.util.Random;
import java.util.function.Consumer;
+import com.example.Sensor;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;