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 byAvroSerializer
andAvroDeserializer
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AvroProperties.AvroEncoding
Options forENCODING_TYPE
.static class
AvroProperties.AvroRecordType
Options forRECORD_TYPE
.
-
Field Summary
Fields Modifier and Type Field Description static String
DEREFERENCED_SCHEMA
Optional boolean flag that instructs the SERDES to request the dereferenced Avro schema from the registry.static String
ENCODING_TYPE
Select the type of encoding for theAvroSerializer
.static String
RECORD_TYPE
Selects 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.AvroEncoding
getEncodingType()
Gets the encoding type for Avro serialization.AvroProperties.AvroRecordType
getRecordType()
Gets the record type for Avro deserialization.boolean
resolveDereferenced()
Retrieves theDEREFERENCED_SCHEMA
boolean 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.AvroEncoding
or String representation of theAvroProperties.AvroEncoding
enum.- 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.AvroRecordType
or String representations of theAvroProperties.AvroRecordType
enum.- 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_ARTIFACT
is 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_TYPE
matches one of the following cases:- The value is neither a
String
nor 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_TYPE
matches one of the following cases:- The value is neither a
String
nor 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_SCHEMA
boolean flag that determines whether the SERDES should request to have the Avro schema dereferenced from the registry.- Returns:
- The boolean value of the
DEREFERENCED_SCHEMA
boolean flag.
-
-