private void LogMessageHandler(Kafka.IConsumer <TKey, TValue> consumer, LogMessage logMessage) { if (consumer.Equals(_consumer)) { _events.OnNext(new Event.LogMessageReceived(logMessage)); } }
private void StatisticsHandler(Kafka.IConsumer <TKey, TValue> consumer, string statistics) { if (consumer.Equals(_consumer)) { _events.OnNext(new Event.StatisticsReceived(statistics)); } }
private void PartitionsRevokedHandler(Kafka.IConsumer <TKey, TValue> consumer, List <TopicPartitionOffset> partitions) { if (consumer.Equals(_consumer)) { _events.OnNext(new Event.PartitionsRevoked(partitions)); } }
private void OffsetsCommittedHandler(Kafka.IConsumer <TKey, TValue> consumer, CommittedOffsets committedOffsets) { if (consumer.Equals(_consumer)) { _events.OnNext(new Event.OffsetsCommitted(committedOffsets)); } }
public Adapter(ConsumerConfig config, Func <ConsumerBuilder <TKey, TValue>, ConsumerBuilder <TKey, TValue> > modifier = null) { _consumer = (modifier ?? NullModifier).Invoke(new ConsumerBuilder <TKey, TValue>(config)) .SetPartitionsAssignedHandler(PartitionsAssignedHandler) .SetPartitionsRevokedHandler(PartitionsRevokedHandler) .SetOffsetsCommittedHandler(OffsetsCommittedHandler) .SetStatisticsHandler(StatisticsHandler) .SetLogHandler(LogMessageHandler) .Build(); _events = new Subject <IEvent>(); }