Class SerializerConfig
- java.lang.Object
-
- io.pravega.schemaregistry.serializer.shared.impl.SerializerConfig
-
public class SerializerConfig extends java.lang.ObjectSerializer Config class that is passed toSerializerFactoryfor creating serializer.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSerializerConfig.Decodersstatic classSerializerConfig.SerializerConfigBuilder
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SerializerConfig.SerializerConfigBuilderbuilder()protected booleancanEqual(java.lang.Object other)booleanequals(java.lang.Object o)SerializerConfig.DecodersgetDecoders()Function that should be applied on serialized data read from stream.EncodergetEncoder()Codec to use for encoding events after serializing them.@NonNull java.lang.StringgetGroupId()Name of the group.java.lang.StringgetNamespace()Namespace for the group.inthashCode()booleanisCreateGroup()booleanisFailOnCodecMismatch()Tells the deserializer that if supplied decoder codecTypes do not match group codecTypes then fail and exit upfront.booleanisRegisterCodec()Flag to tell the serializer if the codec should be automatically registered before using the serializer inEventStreamWriter.booleanisRegisterSchema()Flag to tell the serializer if the schema should be automatically registered before using it inEventStreamWriter.booleanisWriteEncodingHeader()Flag to tell the serializer/deserializer if the encoding id should be added as a header with each event.java.lang.StringtoString()
-
-
-
Method Detail
-
isCreateGroup
public boolean isCreateGroup()
-
builder
public static SerializerConfig.SerializerConfigBuilder builder()
-
getGroupId
@NonNull public @NonNull java.lang.String getGroupId()
Name of the group.
-
getNamespace
public java.lang.String getNamespace()
Namespace for the group.
-
isRegisterSchema
public boolean isRegisterSchema()
Flag to tell the serializer if the schema should be automatically registered before using it inEventStreamWriter. It is recommended to register keep this flag as false in production systems and manage schema evolution explicitly and in lockstep with upgrade of existing pravega client applications.
-
isRegisterCodec
public boolean isRegisterCodec()
Flag to tell the serializer if the codec should be automatically registered before using the serializer inEventStreamWriter. It is recommended to register keep this flag as false in production systems and manage codecTypes used by writers explicitly so that readers are aware of encodings used.
-
getEncoder
public Encoder getEncoder()
Codec to use for encoding events after serializing them.
-
getDecoders
public SerializerConfig.Decoders getDecoders()
Function that should be applied on serialized data read from stream. This is invoked after reading the codecType fromEncodingInfoand using the codec type read from it. It should return the decoded data back to the deserializer. UseSerializerConfig.SerializerConfigBuilder.decoder(String, Decoder)to add decoders. Any number of decoders can be added.
-
isFailOnCodecMismatch
public boolean isFailOnCodecMismatch()
Tells the deserializer that if supplied decoder codecTypes do not match group codecTypes then fail and exit upfront. This is important when the writers have used a custom codec for which reader should be instantiated with a corresponding decoder otherwise it would fail to decode and read the data. As an example, if writer applications had implemented a custom encryption encoder which encrypted the data after serializing it, then the data will include an encoding id that will be resolved to the schema and the codec type name for the encryption codec. If the readers are not provided with a decoder for all data encoded with that codec type, it would fail to decode that data. This flag ensures that the readers check retrieve all the registered codec types with the registry service and fail if they are not instantiated with decoders for all the registered codec types. The default value for this is true.
-
isWriteEncodingHeader
public boolean isWriteEncodingHeader()
Flag to tell the serializer/deserializer if the encoding id should be added as a header with each event. By default this is set to true. If users choose to not add the header, they should do so in all their writer and reader applications for the given stream. Adding the event header is a requirement for following cases: IfSerializationFormat.Avrois chosen for a group, the event header cannot be false. If streams can have multiple types of events, this cannot be false. If streams can multiple formats of events, this cannot be false.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
canEqual
protected boolean canEqual(java.lang.Object other)
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-