Bläddra i källkod

add producerclient

master
yangxiaodong 7 år sedan
förälder
incheckning
e631ca7482
2 ändrade filer med 12 tillägg och 26 borttagningar
  1. +1
    -26
      src/Cap.Consistency.Kafka/KafkaConsumerClient.cs
  2. +11
    -0
      src/Cap.Consistency.Kafka/KafkaProducerClient.cs

+ 1
- 26
src/Cap.Consistency.Kafka/KafkaConsumerClient.cs Visa fil

@@ -9,14 +9,7 @@ using Confluent.Kafka.Serialization;

namespace Cap.Consistency.Kafka
{
public class KafkaTopicPartition
{
public string Topic { get; set; }

public int Partition { get; set; }
}

public class KafkaConsumerClient : IConsumerClient, IDisposable
public class KafkaConsumerClient : IConsumerClient
{

private readonly string _groupId;
@@ -47,22 +40,6 @@ namespace Cap.Consistency.Kafka
_consumerClient.Assignment.Add(new TopicPartition(topicName, partition));
}

public void Subscribe(IEnumerable<KafkaTopicPartition> topicList) {

if (_consumerClient == null) {
InitKafkaClient();
}

if (topicList == null || topicList.Count() == 0) {
throw new ArgumentNullException(nameof(topicList));
}

foreach (var item in topicList) {
Subscribe(item.Topic, item.Partition);
}
}


public void Listening(TimeSpan timeout) {
while (true) {
_consumerClient.Poll(timeout);
@@ -95,7 +72,5 @@ namespace Cap.Consistency.Kafka
#endregion

//public void

}
}

+ 11
- 0
src/Cap.Consistency.Kafka/KafkaProducerClient.cs Visa fil

@@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace Cap.Consistency.Kafka
{
public class KafkaProducerClient
{

}
}

Laddar…
Avbryt
Spara