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);
        }
예제 #2
0
        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);
        }