Package com.solace.serdes.avro
Class AvroSerializer<T>
- java.lang.Object
-
- com.solace.serdes.common.AbstractSerializer<T,org.apache.avro.Schema>
-
- com.solace.serdes.avro.AvroSerializer<T>
-
- Type Parameters:
T
- The type of object to be serialized. Should be castable to either a GenericRecord or SpecificRecord
- All Implemented Interfaces:
com.solace.serdes.Serializer<T>
,Closeable
,AutoCloseable
public class AvroSerializer<T> extends AbstractSerializer<T,org.apache.avro.Schema>
An Avro serializer that converts objects of type T into byte arrays. Configuration properties can be found inAvroProperties
andSerdeProperties
.
AvroSerializer
does not support non-header encoding of schema ID. Must useAbstractSerializer.serialize(String, Object, Map)
to ensure the schema ID is available for encoding. UsingAbstractSerializer.serialize(String, Object)
will not provide the schema ID.
Note: A Vertx connection will be made when configuring thisAvroSerializer
. Vertx threads are non-daemon and will prevent JVM exit, so always remember to callAbstractSerializer.close()
.- See Also:
AvroProperties
,SerdeProperties
-
-
Constructor Summary
Constructors Constructor Description AvroSerializer()
Creates an instance of an AvroSerializer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
configure(Map<String,?> properties)
Configures the serializer with the given properties.-
Methods inherited from class com.solace.serdes.common.AbstractSerializer
close, serialize, serialize
-
-
-
-
Constructor Detail
-
AvroSerializer
public AvroSerializer()
Creates an instance of an AvroSerializer. Once created,configure(java.util.Map)
must be called to use this instance.
-
-
Method Detail
-
configure
public void configure(Map<String,?> properties)
Configures the serializer with the given properties. Properties are defined inAvroProperties
andSerdeProperties
Note: A Vertx connection will be made when configuring thisAvroSerializer
. Vertx threads are non-daemon and will prevent JVM exit, so always remember to callAbstractSerializer.close()
.- Specified by:
configure
in interfacecom.solace.serdes.Serializer<T>
- Overrides:
configure
in classAbstractSerializer<T,org.apache.avro.Schema>
- Parameters:
properties
- A Map containing configuration properties.- See Also:
AvroProperties
,SerdeProperties
-
-