Represents Kafka broker
Example #1
0
 private void MakeAssertionsForBroker(Broker broker, int expectedId, string expectedHost, int expectedPort)
 {
     Assert.IsNotNull(broker);
     Assert.AreEqual(expectedId, broker.Id);
     Assert.AreEqual(expectedHost, broker.Host);
     Assert.AreEqual(expectedPort, broker.Port);
 }
 public PartitionMetadata(int partitionId, Broker leader, IEnumerable<Broker> replicas, IEnumerable<Broker> isr)
 {
     this.PartitionId = partitionId;
     this.Leader = leader;
     this.Replicas = replicas;
     this.Isr = isr;
 }
 public void ShouldAbleToCreateBroker()
 {
     var broker = new Broker(1, "host1", 1234);
     broker.Id.Should().Be(1);
     broker.Host.Should().Be("host1");
     broker.Port.Should().Be(1234);
     broker.SizeInBytes.Should().Be(BitWorks.GetShortStringLength("host1", "UTF-8") + 8);
 }
Example #4
0
 internal FetcherRunnable(string name, IZooKeeperClient zkClient, ConsumerConfig config, Broker broker, List<PartitionTopicInfo> partitionTopicInfos)
 {
     this.name = name;
     this.zkClient = zkClient;
     this.config = config;
     this.broker = broker;
     this.partitionTopicInfos = partitionTopicInfos;
     this.simpleConsumer = new Consumer(this.config);
 }
 public void AddProducer(Broker broker)
 {
     var syncProducerConfig = new SyncProducerConfiguration(this.Config, broker.Id, broker.Host, broker.Port);
     var producerWrapper = new SyncProducerWrapper(syncProducerConfig, this.Config.SyncProducerOfOneBroker);
     Logger.DebugFormat("Creating sync producer for broker id = {0} at {1}:{2} SyncProducerOfOneBroker:{3}", broker.Id, broker.Host, broker.Port, this.Config.SyncProducerOfOneBroker);
     this.syncProducers.TryAdd(broker.Id, producerWrapper);
 }