public override AbstractFetcherThread CreateFetcherThread(int fetcherId, Broker sourceBroker) { return new ConsumerFetcherThread( string.Format("ConsumerFetcherThread-{0}-{1}-{2}", this.consumerIdString, fetcherId, sourceBroker.Id), this.config, sourceBroker, this.partitionMap, this); }
public PartitionMetadata(int partitionId, Broker leader, IEnumerable<Broker> replicas, IEnumerable<Broker> isr = null, short errorCode = ErrorMapping.NoError) { if (isr == null) { isr = Enumerable.Empty<Broker>(); } this.PartitionId = partitionId; this.Leader = leader; this.Replicas = replicas; this.Isr = isr; this.ErrorCode = errorCode; }
public ConsumerFetcherThread( string name, ConsumerConfig config, Broker sourceBroker, IDictionary<TopicAndPartition, PartitionTopicInfo> partitionMap, ConsumerFetcherManager consumerFetcherManager) : base( name, config.ClientId + "-" + name, sourceBroker, config.SocketTimeoutMs, config.SocketReceiveBufferBytes, config.FetchMessageMaxBytes, Request.OrdinaryConsumerId, config.FetchWaitMaxMs, config.FetchMinBytes, true) { this.partitionMap = partitionMap; this.config = config; this.consumerFetcherManager = consumerFetcherManager; }
internal AbstractFetcherThread( string name, string clientId, Broker sourceBroker, int socketTimeout, int socketBufferSize, int fetchSize, int fetcherBrokerId = -1, int maxWait = 0, int minBytes = 1, bool isInterruptible = true) : base(name, isInterruptible) { this.clientId = clientId; this.sourceBroker = sourceBroker; this.socketTimeout = socketTimeout; this.socketBufferSize = socketBufferSize; this.fetchSize = fetchSize; this.fetcherBrokerId = fetcherBrokerId; this.maxWait = maxWait; this.minBytes = minBytes; this.partitionMapLock = new ReentrantLock(); this.partitionMapCond = this.partitionMapLock.NewCondition(); this.simpleConsumer = new SimpleConsumer( sourceBroker.Host, sourceBroker.Port, socketTimeout, socketBufferSize, clientId); this.brokerInfo = string.Format("host_{0}-port_{1}", sourceBroker.Host, sourceBroker.Port); this.metricId = new ClientIdAndBroker(clientId, this.brokerInfo); this.FetcherStats = new FetcherStats(this.metricId); this.FetcherLagStats = new FetcherLagStats(this.metricId); this.fetchRequestBuilder = new FetchRequestBuilder().ClientId(clientId) .ReplicaId(fetcherBrokerId) .MaxWait(maxWait) .MinBytes(minBytes); }
public static SyncProducer CreateSyncProducer(ProducerConfig config, Broker broker) { return new SyncProducer(new SyncProducerConfig(config, broker.Host, broker.Port)); }
protected bool Equals(Broker other) { return this.Id == other.Id && string.Equals(this.Host, other.Host) && this.Port == other.Port; }
private string FormatBroker(Broker broker) { return string.Format("{0} ({1}:{2})", broker.Id, broker.Host, broker.Port); }
// to be defined in subclass to create a specific fetcher public abstract AbstractFetcherThread CreateFetcherThread(int fetcherId, Broker sourceBroker);
public BrokerAndInitialOffset(Broker broker, long initOffset) { this.Broker = broker; this.InitOffset = initOffset; }
public BrokerAndFetcherId(Broker broker, int fetcherId) { this.Broker = broker; this.FetcherId = fetcherId; }
public void Add(Broker broker) { this.brokers[broker.Id] = broker; }