Class SerDes<T, TJVMT>
- Namespace
- MASES.KNet.Serialization
- Assembly
- MASES.KNet.dll
Common serializer/deserializer
public class SerDes<T, TJVMT> : ISerDes<T, TJVMT>, ISerializer<T, TJVMT>, IDeserializer<T, TJVMT>, ISerDes, IDisposable
Type Parameters
T
The type to serialize/deserialize
TJVMT
The corresponding JVM type used
- Inheritance
-
SerDes<T, TJVMT>
- Implements
-
ISerDes<T, TJVMT>ISerializer<T, TJVMT>IDeserializer<T, TJVMT>
- Derived
- Inherited Members
Constructors
SerDes()
Default initializer
public SerDes()
Properties
IsDirectBuffered
Set to true in implementing class if the implementation uses the support of direct buffer data exchange
public virtual bool IsDirectBuffered { get; }
Property Value
Remarks
If set to true, the KNet classes will use ByteBufferSerializer and ByteBufferDeserializer as backing JVM classes
JVMDeserializerClass
public Class JVMDeserializerClass { get; protected set; }
Property Value
JVMDeserializerClassName
Returns the deserializer class name to be used
public string JVMDeserializerClassName { get; protected set; }
Property Value
JVMSerDesClass
public Class JVMSerDesClass { get; protected set; }
Property Value
JVMSerDesClassName
Returns the serializer class name to be used
public string JVMSerDesClassName { get; protected set; }
Property Value
JVMSerializerClass
public Class JVMSerializerClass { get; protected set; }
Property Value
JVMSerializerClassName
Returns the serializer class name to be used
public string JVMSerializerClassName { get; protected set; }
Property Value
JVMType
public Type JVMType { get; }
Property Value
KafkaDeserializer
The Deserializer<T> to use in Apache Kafka
public Deserializer<TJVMT> KafkaDeserializer { get; }
Property Value
- Deserializer<TJVMT>
KafkaSerde
The Serde<T> to use in Apache Kafka
public Serde<TJVMT> KafkaSerde { get; }
Property Value
- Serde<TJVMT>
KafkaSerializer
The Serializer<T> to use in Apache Kafka
public Serializer<TJVMT> KafkaSerializer { get; }
Property Value
- Serializer<TJVMT>
OnDeserialize
External deserialization function
public Func<string, TJVMT, T> OnDeserialize { get; set; }
Property Value
OnDeserializeWithHeaders
External deserialization function using Headers
public Func<string, Headers, TJVMT, T> OnDeserializeWithHeaders { get; set; }
Property Value
OnSerialize
External serialization function
public Func<string, T, TJVMT> OnSerialize { get; set; }
Property Value
OnSerializeWithHeaders
External serialization function using Headers
public Func<string, Headers, T, TJVMT> OnSerializeWithHeaders { get; set; }
Property Value
Type
public Type Type { get; }
Property Value
UseHeaders
public virtual bool UseHeaders { get; set; }
Property Value
UseKafkaClassForSupportedTypes
Set to true in implementing class if the implementation shall use the serializer of Apache Kafka, default is false
public virtual bool UseKafkaClassForSupportedTypes { get; set; }
Property Value
Remarks
When this option is set to true there is better compatibility with data managed from Apache Kafka, but there is a performance impact
Methods
Deserialize(string, TJVMT)
Executes the Deserializer action in the CLR
public virtual T Deserialize(string topic, TJVMT data)
Parameters
topic
stringtopic associated with the data
data
TJVMTserialized bytes; may be null; implementations are recommended to handle null by returning a value or null rather than throwing an exception
Returns
- T
The deserialized
T
DeserializeWithHeaders(string, Headers, TJVMT)
Executes the Deserializer action in the CLR
public virtual T DeserializeWithHeaders(string topic, Headers headers, TJVMT data)
Parameters
topic
stringtopic associated with the data
headers
HeadersHeaders associated with the record; may be empty.
data
TJVMTserialized bytes; may be null; implementations are recommended to handle null by returning a value or null rather than throwing an exception
Returns
- T
The deserialized
T
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
~SerDes()
Finalizer
protected ~SerDes()
Serialize(string, T)
Executes the Serializer action in the CLR
public virtual TJVMT Serialize(string topic, T data)
Parameters
topic
stringtopic associated with the data
data
TT
data
Returns
- TJVMT
serialized bytes
SerializeWithHeaders(string, Headers, T)
Executes the Serializer action in the CLR
public virtual TJVMT SerializeWithHeaders(string topic, Headers headers, T data)
Parameters
topic
stringtopic associated with the data
headers
HeadersHeaders associated with the record; may be empty.
data
TT
data
Returns
- TJVMT
serialized bytes