Class VeniceAvroKafkaSerializer
java.lang.Object
com.linkedin.venice.serialization.avro.VeniceAvroKafkaSerializer
- All Implemented Interfaces:
VeniceKafkaSerializer<Object>,Closeable,AutoCloseable
This class is a thin wrapper of
AvroSerializer and AvroGenericDeserializer.
It is necessary to have a separate class responsible for this in this module in order to implement
Kafka's interface, which is a dependency we do not want to leak into the schema-common module where
the two above classes are located.-
Constructor Summary
ConstructorsConstructorDescriptionVeniceAvroKafkaSerializer(String schemaStr) VeniceAvroKafkaSerializer(org.apache.avro.Schema schema) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close this serializer.voidConfigure this class.deserialize(byte[] bytes) deserialize(String topic, byte[] bytes) Create an object from an array of bytesdeserialize(ByteBuffer byteBuffer) byte[]Construct an array of bytes from the given object
-
Constructor Details
-
VeniceAvroKafkaSerializer
-
VeniceAvroKafkaSerializer
public VeniceAvroKafkaSerializer(org.apache.avro.Schema schema)
-
-
Method Details
-
close
public void close()Close this serializer. This method has to be idempotent if the serializer is used in KafkaProducer because it might be called multiple times.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceVeniceKafkaSerializer<Object>
-
configure
Configure this class.- Specified by:
configurein interfaceVeniceKafkaSerializer<Object>- Parameters:
configMap- configs in key/value pairsisKey- whether is for key or value
-
serialize
Description copied from interface:VeniceKafkaSerializerConstruct an array of bytes from the given object- Specified by:
serializein interfaceVeniceKafkaSerializer<Object>- Parameters:
topic- Topic to which the object belongs.object- The object- Returns:
- The bytes taken from the object
-
deserialize
Description copied from interface:VeniceKafkaSerializerCreate an object from an array of bytes- Specified by:
deserializein interfaceVeniceKafkaSerializer<Object>- Parameters:
topic- Topic to which the array of bytes belongs.bytes- An array of bytes with the objects data- Returns:
- A java object serialzed from the bytes
-
deserialize
-
deserialize
-