Table of Contents

Class KNetConsumer<K, V, TJVMK, TJVMV>

Namespace
MASES.KNet.Consumer
Assembly
MASES.KNet.dll

KNet extension of KafkaConsumer<K, V>

public class KNetConsumer<K, V, TJVMK, TJVMV> : KafkaConsumer<TJVMK, TJVMV>, IDynamicMetaObjectProvider, IJVMBridgeCore, IEquatable<IJVMBridgeBase>, IJVMBridgeBaseStatic, IConsumer<K, V, TJVMK, TJVMV>, IConsumer<TJVMK, TJVMV>, IConsumer, IJVMBridgeBase, IJVMBridgeDefinition, IDisposable, ICloseable, IAutoCloseable

Type Parameters

K

The key type

V

The value type

TJVMK

The JVM type of K

TJVMV

The JVM type of V

Inheritance
Consumer<TJVMK, TJVMV>
KafkaConsumer<TJVMK, TJVMV>
KNetConsumer<K, V, TJVMK, TJVMV>
Implements
IConsumer<K, V, TJVMK, TJVMV>
IConsumer<TJVMK, TJVMV>
Derived
Inherited Members
Extension Methods

Constructors

KNetConsumer(ConsumerConfigBuilder, ISerDes<K, TJVMK>, ISerDes<V, TJVMV>, bool)

Initialize a new instance of KNetConsumer<K, V, TJVMK, TJVMV>

public KNetConsumer(ConsumerConfigBuilder props, ISerDes<K, TJVMK> keyDeserializer, ISerDes<V, TJVMV> valueDeserializer, bool useJVMCallback = false)

Parameters

props ConsumerConfigBuilder

The properties to use, see ConsumerConfigBuilder

keyDeserializer ISerDes<K, TJVMK>

Key serializer base on SerDes<T, TJVMT>

valueDeserializer ISerDes<V, TJVMV>

Value serializer base on SerDes<T, TJVMT>

useJVMCallback bool

true to active callback based mode

KNetConsumer(ConsumerConfigBuilder, bool)

Initialize a new instance of KNetConsumer<K, V, TJVMK, TJVMV>

public KNetConsumer(ConsumerConfigBuilder configBuilder, bool useJVMCallback = false)

Parameters

configBuilder ConsumerConfigBuilder

An instance of ConsumerConfigBuilder

useJVMCallback bool

true to active callback based mode

Properties

BridgeClassName

Java class name to be instantiated

public override string BridgeClassName { get; }

Property Value

string

IsCompleting

true if the IConsumer<K, V, TJVMK, TJVMV> instance is completing async operation

public bool IsCompleting { get; }

Property Value

bool

IsEmpty

true if the IConsumer<K, V, TJVMK, TJVMV> instance has an empty set of items in async operation

public bool IsEmpty { get; }

Property Value

bool

WaitingMessages

Number of messages in the IConsumer<K, V, TJVMK, TJVMV> instance waiting to be processed in async operation

public int WaitingMessages { get; }

Property Value

int

Methods

Consume(long, Action<ConsumerRecord<K, V, TJVMK, TJVMV>>)

KNet sync extension for Poll(Duration)

public void Consume(long timeoutMs, Action<ConsumerRecord<K, V, TJVMK, TJVMV>> callback)

Parameters

timeoutMs long

Timeout in milliseconds

callback Action<ConsumerRecord<K, V, TJVMK, TJVMV>>

The Action<T> where receives ConsumerRecord<K, V, TJVMK, TJVMV>

ConsumeAsync(long)

KNet async extension for Poll(Duration)

public bool ConsumeAsync(long timeoutMs)

Parameters

timeoutMs long

Timeout in milliseconds

Returns

bool

true if something was enqued for Async operations

Dispose(bool)

protected override void Dispose(bool disposing)

Parameters

disposing bool

The disposing parameter is a bool that indicates whether the method call comes from a Dispose() method (its value is true) or from a finalizer (its value is false)

~KNetConsumer()

Finalizer

protected ~KNetConsumer()

Poll(long)

KNet extension for Poll(Duration)

public ConsumerRecords<K, V, TJVMK, TJVMV> Poll(long timeoutMs)

Parameters

timeoutMs long

Timeout in milliseconds

Returns

ConsumerRecords<K, V, TJVMK, TJVMV>

ConsumerRecords<K, V, TJVMK, TJVMV>

Poll(TimeSpan)

KNet extension for Poll(Duration)

public ConsumerRecords<K, V, TJVMK, TJVMV> Poll(TimeSpan timeout)

Parameters

timeout TimeSpan

Timeout expressed as TimeSpan

Returns

ConsumerRecords<K, V, TJVMK, TJVMV>

ConsumerRecords<K, V, TJVMK, TJVMV>

SetCallback(Action<ConsumerRecord<K, V, TJVMK, TJVMV>>)

Sets the Action<T> to use to receive ConsumerRecord<K, V, TJVMK, TJVMV>

public void SetCallback(Action<ConsumerRecord<K, V, TJVMK, TJVMV>> cb)

Parameters

cb Action<ConsumerRecord<K, V, TJVMK, TJVMV>>

The callback Action<T>