Commit e631ca74 authored by yangxiaodong's avatar yangxiaodong

add producerclient

parent 0476ed43
......@@ -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
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Cap.Consistency.Kafka
{
public class KafkaProducerClient
{
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment