Interface AvroSchemaServiceManager
-
- All Known Implementing Classes:
AvroSchemaServiceManagerImpl
public interface AvroSchemaServiceManagerManage aSchematogether with its String representation. Helps to substitute the default implementation ofSchemaGeneration using Custom Avro schema generator Provide a custom bean definition ofAvroSchemaServiceManagerto override the default implementation. Migrating this interface from the original Spring Cloud Schema Registry project.- Since:
- 3.2.0
- Author:
- Ish Mahajan, Soby Chacko
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description org.apache.avro.io.DatumReader<Object>getDatumReader(Class<? extends Object> type, org.apache.avro.Schema schema, org.apache.avro.Schema writerSchema)getDatumReader.org.apache.avro.io.DatumWriter<Object>getDatumWriter(Class<? extends Object> type, org.apache.avro.Schema schema)getDatumWriter.org.apache.avro.SchemagetSchema(Class<?> clazz)getSchema.ObjectreadData(Class<? extends Object> targetClass, byte[] payload, org.apache.avro.Schema readerSchema, org.apache.avro.Schema writerSchema)read data from avro type payloadDatumReader.
-
-
-
Method Detail
-
getSchema
org.apache.avro.Schema getSchema(Class<?> clazz)
getSchema.- Parameters:
clazz-Classfor which schema generation is required- Returns:
- returns avro schema for given class
-
getDatumWriter
org.apache.avro.io.DatumWriter<Object> getDatumWriter(Class<? extends Object> type, org.apache.avro.Schema schema)
getDatumWriter.- Parameters:
type-Classof java object which needs to be serializedschema-Schemaof object which needs to be serialized- Returns:
- datum writer which can be used to write Avro payload
-
getDatumReader
org.apache.avro.io.DatumReader<Object> getDatumReader(Class<? extends Object> type, org.apache.avro.Schema schema, org.apache.avro.Schema writerSchema)
getDatumReader.- Parameters:
type-Classof java object which needs to be serializedschema-Schemadefault schema of object which needs to be de-serializedwriterSchema-SchemawriterSchema provided at run time- Returns:
- datum reader which can be used to read Avro payload
-
readData
Object readData(Class<? extends Object> targetClass, byte[] payload, org.apache.avro.Schema readerSchema, org.apache.avro.Schema writerSchema) throws IOException
read data from avro type payloadDatumReader.- Parameters:
targetClass-Classof java object which needs to be serializedpayload-byteserialized payload of object which needs to be de-serializedreaderSchema-SchemareaderSchema of object which needs to be de-serializedwriterSchema-SchemawriterSchema used to while serializing payload- Returns:
- java object after reading Avro Payload
- Throws:
IOException- in case of error
-
-