Table of Contents

Class EntityExtractor

Namespace
MASES.EntityFrameworkCore.KNet.Serialization
Assembly
MASES.EntityFrameworkCore.KNet.Serialization.dll

This is an helper class to extract data information from Kafka Records stored in topics

public class EntityExtractor
Inheritance
EntityExtractor
Inherited Members

Methods

FromRawValueData(Type, Type, Type, Type, string, byte[], byte[], bool)

Extract information for Entity from recordValue in input

public static object FromRawValueData(Type keyType, Type valueContainer, Type keySerializerSelectorType, Type valueSerializerSelectorType, string topic, byte[] recordValue, byte[] recordKey, bool throwUnmatch = false)

Parameters

keyType Type

Expected key Type

valueContainer Type

Expected ValueContainer Type

keySerializerSelectorType Type

Key serializer to be used

valueSerializerSelectorType Type

ValueContainer serializer to be used

topic string

The Apache Kafka topic the data is coming from

recordValue byte[]

The Apache Kafka record value containing the information

recordKey byte[]

The Apache Kafka record key containing the information

throwUnmatch bool

Throws exceptions if there is unmatch in data retrieve, e.g. a property not available or a not settable

Returns

object

The extracted entity

FromRecord(ConsumerRecord<byte[], byte[]>, bool)

Extract information for Entity from record in input

public static object FromRecord(ConsumerRecord<byte[], byte[]> record, bool throwUnmatch = false)

Parameters

record ConsumerRecord<byte[], byte[]>

The Apache Kafka record containing the information

throwUnmatch bool

Throws exceptions if there is unmatch in data retrieve, e.g. a property not available or a not settable

Returns

object

The extracted entity

FromRecord<TEntity>(ConsumerRecord<byte[], byte[]>, bool)

Extract information for Entity from record in input

public static TEntity FromRecord<TEntity>(ConsumerRecord<byte[], byte[]> record, bool throwUnmatch = false) where TEntity : class

Parameters

record ConsumerRecord<byte[], byte[]>

The Apache Kafka record containing the information

throwUnmatch bool

Throws exceptions if there is unmatch in data retrieve, e.g. a property not available or a not settable

Returns

TEntity

The extracted entity

Type Parameters

TEntity

FromTopic(ConsumerConfigBuilder, string, Action<object?, Exception?>, CancellationToken, bool)

Extract information for Entity using consumerConfig configurtion within a topicName and send them to cb

public static void FromTopic(ConsumerConfigBuilder consumerConfig, string topicName, Action<object?, Exception?> cb, CancellationToken token, bool onlyLatest = false)

Parameters

consumerConfig ConsumerConfigBuilder

The ConsumerConfigBuilder with configuration

topicName string

The topic containing the data

cb Action<object, Exception>

The Action<T1, T2> where data will be available

token CancellationToken

The CancellationToken to use to stop execution

onlyLatest bool

Start execution only for newest messages and does not execute for oldest, default is from beginning

FromTopic(string, string, Action<object?, Exception?>, CancellationToken, bool)

Extract information for Entity from bootstrapServer within a topicName and send them to cb

public static void FromTopic(string bootstrapServer, string topicName, Action<object?, Exception?> cb, CancellationToken token, bool onlyLatest = false)

Parameters

bootstrapServer string

The Apache Kafka bootstrap.servers

topicName string

The topic containing the data

cb Action<object, Exception>

The Action<T1, T2> where data will be available

token CancellationToken

The CancellationToken to use to stop execution

onlyLatest bool

Start execution only for newest messages and does not execute for oldest, default is from beginning

FromTopic<TEntity>(ConsumerConfigBuilder, string, Action<TEntity?, Exception?>, CancellationToken, bool)

Extract information for Entity using consumerConfig configurtion within a topicName and send them to cb

public static void FromTopic<TEntity>(ConsumerConfigBuilder consumerConfig, string topicName, Action<TEntity?, Exception?> cb, CancellationToken token, bool onlyLatest = false) where TEntity : class

Parameters

consumerConfig ConsumerConfigBuilder

The ConsumerConfigBuilder with configuration

topicName string

The topic containing the data

cb Action<TEntity, Exception>

The Action<T1, T2> where data will be available

token CancellationToken

The CancellationToken to use to stop execution

onlyLatest bool

Start execution only for newest messages and does not execute for oldest, default is from beginning

Type Parameters

TEntity

The Entity type if it is known

FromTopic<TEntity>(string, string, Action<TEntity?, Exception?>, CancellationToken, bool)

Extract information for Entity from bootstrapServer within a topicName and send them to cb

public static void FromTopic<TEntity>(string bootstrapServer, string topicName, Action<TEntity?, Exception?> cb, CancellationToken token, bool onlyLatest = false) where TEntity : class

Parameters

bootstrapServer string

The Apache Kafka bootstrap.servers

topicName string

The topic containing the data

cb Action<TEntity, Exception>

The Action<T1, T2> where data will be available

token CancellationToken

The CancellationToken to use to stop execution

onlyLatest bool

Start execution only for newest messages and does not execute for oldest, default is from beginning

Type Parameters

TEntity

The Entity type if it is known