Table of Contents

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

bool

Remarks

If set to true, the KNet classes will use ByteBufferSerializer and ByteBufferDeserializer as backing JVM classes

JVMDeserializerClass

Returns the JVM deserializer Class associated to this ISerDes instance

public Class JVMDeserializerClass { get; protected set; }

Property Value

Class

JVMDeserializerClassName

Returns the deserializer class name to be used

public string JVMDeserializerClassName { get; protected set; }

Property Value

string

JVMSerDesClass

Returns the JVM serdes Class associated to this ISerDes instance

public Class JVMSerDesClass { get; protected set; }

Property Value

Class

JVMSerDesClassName

Returns the serializer class name to be used

public string JVMSerDesClassName { get; protected set; }

Property Value

string

JVMSerializerClass

Returns the JVM serializer Class associated to this ISerDes instance

public Class JVMSerializerClass { get; protected set; }

Property Value

Class

JVMSerializerClassName

Returns the serializer class name to be used

public string JVMSerializerClassName { get; protected set; }

Property Value

string

JVMType

The Type, representing the JVM type, managed from this ISerDes instance

public Type JVMType { get; }

Property Value

Type

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

Func<string, TJVMT, T>

OnDeserializeWithHeaders

External deserialization function using Headers

public Func<string, Headers, TJVMT, T> OnDeserializeWithHeaders { get; set; }

Property Value

Func<string, Headers, TJVMT, T>

OnSerialize

External serialization function

public Func<string, T, TJVMT> OnSerialize { get; set; }

Property Value

Func<string, T, TJVMT>

OnSerializeWithHeaders

External serialization function using Headers

public Func<string, Headers, T, TJVMT> OnSerializeWithHeaders { get; set; }

Property Value

Func<string, Headers, T, TJVMT>

Type

The Type managed from this ISerDes instance

public Type Type { get; }

Property Value

Type

UseHeaders

true if Headers are used

public virtual bool UseHeaders { get; set; }

Property Value

bool

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

bool

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 string

topic associated with the data

data TJVMT

serialized 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 string

topic associated with the data

headers Headers

Headers associated with the record; may be empty.

data TJVMT

serialized 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 string

topic associated with the data

data T

T 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 string

topic associated with the data

headers Headers

Headers associated with the record; may be empty.

data T

T data

Returns

TJVMT

serialized bytes