示例#1
0
 private void LogMessageHandler(Kafka.IConsumer <TKey, TValue> consumer, LogMessage logMessage)
 {
     if (consumer.Equals(_consumer))
     {
         _events.OnNext(new Event.LogMessageReceived(logMessage));
     }
 }
示例#2
0
 private void StatisticsHandler(Kafka.IConsumer <TKey, TValue> consumer, string statistics)
 {
     if (consumer.Equals(_consumer))
     {
         _events.OnNext(new Event.StatisticsReceived(statistics));
     }
 }
示例#3
0
 private void PartitionsRevokedHandler(Kafka.IConsumer <TKey, TValue> consumer, List <TopicPartitionOffset> partitions)
 {
     if (consumer.Equals(_consumer))
     {
         _events.OnNext(new Event.PartitionsRevoked(partitions));
     }
 }
示例#4
0
 private void OffsetsCommittedHandler(Kafka.IConsumer <TKey, TValue> consumer, CommittedOffsets committedOffsets)
 {
     if (consumer.Equals(_consumer))
     {
         _events.OnNext(new Event.OffsetsCommitted(committedOffsets));
     }
 }
示例#5
0
        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>();
        }