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
TThe type to serialize/deserialize
TJVMTThe corresponding JVM type used
- Inheritance
-
SerDes<T, TJVMT>
- Implements
-
ISerDes<T, TJVMT>ISerializer<T, TJVMT>IDeserializer<T, TJVMT>
- Derived
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
OnDeserialize2
External deserialization function
public Func<String, TJVMT, T> OnDeserialize2 { get; set; }
Property Value
OnDeserializeWithHeaders
External deserialization function using Headers
public Func<string, Headers, TJVMT, T> OnDeserializeWithHeaders { get; set; }
Property Value
OnDeserializeWithHeaders2
External deserialization function using Headers
public Func<String, Headers, TJVMT, T> OnDeserializeWithHeaders2 { get; set; }
Property Value
OnSerialize
External serialization function
public Func<string, T, TJVMT> OnSerialize { get; set; }
Property Value
OnSerialize2
External serialization function
public Func<String, T, TJVMT> OnSerialize2 { get; set; }
Property Value
OnSerializeWithHeaders
External serialization function using Headers
public Func<string, Headers, T, TJVMT> OnSerializeWithHeaders { get; set; }
Property Value
OnSerializeWithHeaders2
External serialization function using Headers
public Func<String, Headers, T, TJVMT> OnSerializeWithHeaders2 { 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
topicStringtopic associated with the data
dataTJVMTserialized 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
Deserialize(string, TJVMT)
Executes the Deserializer action in the CLR
public virtual T Deserialize(string topic, TJVMT data)
Parameters
topicstringtopic associated with the data
dataTJVMTserialized 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
topicStringtopic associated with the data
headersHeadersHeaders associated with the record; may be empty.
dataTJVMTserialized 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
topicstringtopic associated with the data
headersHeadersHeaders associated with the record; may be empty.
dataTJVMTserialized 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
topicStringtopic associated with the data
dataTTdata
Returns
- TJVMT
serialized bytes
Serialize(string, T)
Executes the Serializer action in the CLR
public virtual TJVMT Serialize(string topic, T data)
Parameters
topicstringtopic associated with the data
dataTTdata
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
topicStringtopic associated with the data
headersHeadersHeaders associated with the record; may be empty.
dataTTdata
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
topicstringtopic associated with the data
headersHeadersHeaders associated with the record; may be empty.
dataTTdata
Returns
- TJVMT
serialized bytes