Package com.solace.serdes.avro
Class AvroProperties
- java.lang.Object
-
- com.solace.serdes.common.resolver.config.BaseProperties
-
- com.solace.serdes.common.SerdeProperties
-
- com.solace.serdes.avro.AvroProperties
-
public class AvroProperties extends SerdeProperties
A class for configuring Avro specific properties. This is used byAvroSerializerandAvroDeserializer.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAvroProperties.AvroEncodingOptions forENCODING_TYPE.static classAvroProperties.AvroRecordTypeOptions forRECORD_TYPE.
-
Field Summary
Fields Modifier and Type Field Description static StringDEREFERENCED_SCHEMAOptional boolean flag that instructs the SERDES to request the dereferenced Avro schema from the registry.static StringENCODING_TYPESelect the type of encoding for theAvroSerializer.static StringRECORD_TYPESelects the type of record to be used forAvroDeserializer.-
Fields inherited from class com.solace.serdes.common.SerdeProperties
DESERIALIZED_TYPE, EXPLICIT_SCHEMA_ID, SCHEMA_HEADER_IDENTIFIERS, SCHEMA_RESOLVER
-
-
Constructor Summary
Constructors Constructor Description AvroProperties()Constructs a new AvroProperties instance with default properties.AvroProperties(Map<String,?> map)Constructs a new AvroProperties instance with default properties then applies properties from the passed in map.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Map<String,Object>getDefaults()Gets a copy of the default AvroProperties properties.AvroProperties.AvroEncodinggetEncodingType()Gets the encoding type for Avro serialization.AvroProperties.AvroRecordTypegetRecordType()Gets the record type for Avro deserialization.booleanresolveDereferenced()Retrieves theDEREFERENCED_SCHEMAboolean flag that determines whether the SERDES should request to have the Avro schema dereferenced from the registry.-
Methods inherited from class com.solace.serdes.common.SerdeProperties
getDeserializedType, getExplicitSchemaId, getSchemaHeaderIdentifiers, getSchemaResolverClass
-
Methods inherited from class com.solace.serdes.common.resolver.config.BaseProperties
getConfig
-
-
-
-
Field Detail
-
ENCODING_TYPE
public static final String ENCODING_TYPE
Select the type of encoding for theAvroSerializer. Valid values includeAvroProperties.AvroEncodingor String representation of theAvroProperties.AvroEncodingenum.- See Also:
- Constant Field Values
-
RECORD_TYPE
public static final String RECORD_TYPE
Selects the type of record to be used forAvroDeserializer. Valid values includeAvroProperties.AvroRecordTypeor String representations of theAvroProperties.AvroRecordTypeenum.- See Also:
- Constant Field Values
-
DEREFERENCED_SCHEMA
public static final String DEREFERENCED_SCHEMA
Optional boolean flag that instructs the SERDES to request the dereferenced Avro schema from the registry.Important notes:
- If
SchemaResolverProperties.FIND_LATEST_ARTIFACTis set to true, this property is ignored. - When this property is enabled, referenced Avro schemas stored in the registry cannot be resolved. Therefore, only use dereferenced Avro schemas if this property is set to true.
- See Also:
- Constant Field Values
- If
-
-
Method Detail
-
getDefaults
public static Map<String,Object> getDefaults()
Gets a copy of the default AvroProperties properties. This contains defaults defined inSerdeProperties.- Returns:
- A copy of the default set properties.
- See Also:
SerdeProperties
-
getEncodingType
public AvroProperties.AvroEncoding getEncodingType()
Gets the encoding type for Avro serialization. Defaults to BINARY.- Returns:
- The Avro encoding type
- Throws:
IllegalStateException- when the keyAvroProperties.ENCODING_TYPEmatches one of the following cases:- The value is neither a
Stringnor aAvroProperties.AvroEncoding - The value is a
String, but is not parsable as aAvroProperties.AvroEncoding
- The value is neither a
-
getRecordType
public AvroProperties.AvroRecordType getRecordType()
Gets the record type for Avro deserialization. Defaults to GENERIC_RECORD.- Returns:
- The Avro record type
- Throws:
IllegalStateException- when the keyAvroProperties.RECORD_TYPEmatches one of the following cases:- The value is neither a
Stringnor aAvroProperties.AvroRecordType - The value is a
String, but is not parsable as aAvroProperties.AvroRecordType
- The value is neither a
-
resolveDereferenced
public boolean resolveDereferenced()
Retrieves theDEREFERENCED_SCHEMAboolean flag that determines whether the SERDES should request to have the Avro schema dereferenced from the registry.- Returns:
- The boolean value of the
DEREFERENCED_SCHEMAboolean flag.
-
-