Class KNetShareConsumer<K, V, TJVMK, TJVMV>
KNet extension of KafkaConsumer<K, V>
public class KNetShareConsumer<K, V, TJVMK, TJVMV> : KafkaShareConsumer<TJVMK, TJVMV>, IDynamicMetaObjectProvider, IJVMBridgeCore, IEquatable<IJVMBridgeBase>, IDisposable, IJVMBridgeBaseStatic, IJVMBridgeBase, IJVMBridgeDefinition, IShareConsumer<K, V, TJVMK, TJVMV>, IShareConsumer<TJVMK, TJVMV>, ICloseable, IAutoCloseable
Type Parameters
KThe key type
VThe value type
TJVMKThe JVM type of
KTJVMVThe JVM type of
V
- Inheritance
-
ShareConsumer<TJVMK, TJVMV>KafkaShareConsumer<TJVMK, TJVMV>KNetShareConsumer<K, V, TJVMK, TJVMV>
- Implements
-
IShareConsumer<K, V, TJVMK, TJVMV>IShareConsumer<TJVMK, TJVMV>
- Derived
- Inherited Members
-
JVMBridgeBase<AutoCloseable>.SExecuteWithSignature(Type, IJavaType, string, string, params object[])JVMBridgeBase<AutoCloseable>.SExecute<TReturn, TConverter>(Type, IJavaType, string, params object[])JVMBridgeBase<AutoCloseable>.SExecuteWithSignatureArray<TArrayType>(string, string, params object[])
Constructors
KNetShareConsumer(ConsumerConfigBuilder, ISerDes<K, TJVMK>, ISerDes<V, TJVMV>, bool)
Initialize a new instance of KNetShareConsumer<K, V, TJVMK, TJVMV>
public KNetShareConsumer(ConsumerConfigBuilder props, ISerDes<K, TJVMK> keyDeserializer, ISerDes<V, TJVMV> valueDeserializer, bool useJVMCallback = false)
Parameters
propsConsumerConfigBuilderThe properties to use, see ConsumerConfigBuilder
keyDeserializerISerDes<K, TJVMK>Key serializer base on SerDes<T, TJVMT>
valueDeserializerISerDes<V, TJVMV>Value serializer base on SerDes<T, TJVMT>
useJVMCallbackbooltrue to active callback based mode
KNetShareConsumer(ConsumerConfigBuilder, bool)
Initialize a new instance of KNetShareConsumer<K, V, TJVMK, TJVMV>
public KNetShareConsumer(ConsumerConfigBuilder configBuilder, bool useJVMCallback = false)
Parameters
configBuilderConsumerConfigBuilderAn instance of ConsumerConfigBuilder
useJVMCallbackbooltrue to active callback based mode
Properties
BridgeClassName
Java class name to be instantiated
public override string BridgeClassName { get; }
Property Value
IsCompleting
true if the IShareConsumer<K, V, TJVMK, TJVMV> instance is completing async operation
public bool IsCompleting { get; }
Property Value
IsEmpty
true if the IShareConsumer<K, V, TJVMK, TJVMV> instance has an empty set of items in async operation
public bool IsEmpty { get; }
Property Value
WaitingMessages
Number of messages in the IShareConsumer<K, V, TJVMK, TJVMV> instance waiting to be processed in async operation
public int WaitingMessages { get; }
Property Value
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
timeoutMslongTimeout in milliseconds
callbackAction<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
timeoutMslongTimeout in milliseconds
Returns
Dispose(bool)
Implements the pattern described in https://learn.microsoft.com/en-en/dotnet/standard/garbage-collection/implementing-dispose
protected override void Dispose(bool disposing)
Parameters
disposingboolThe 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)
~KNetShareConsumer()
Finalizer
protected ~KNetShareConsumer()
Poll(TimeSpan)
KNet extension for Poll(Duration)
public ConsumerRecords<K, V, TJVMK, TJVMV> Poll(TimeSpan timeout)
Parameters
Returns
- 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
cbAction<ConsumerRecord<K, V, TJVMK, TJVMV>>The callback Action<T>