Пример #1
0
        /// <summary>
        /// Handle the connection of a fetcher (potentially a new fetcher) for this partition
        /// </summary>
        /// <param name="newFetcher">The fetcher to use to fetch for this TopicPartition</param>
        private void OnNewFetcher(Fetcher newFetcher)
        {
            // first close the subscription to the old fetcher if there is one.
            if (_currentfetcherSubscription != null)
            {
                _currentfetcherSubscription.Dispose();
            }

            // now subscribe to the new fetcher. This will begin pumping messages through to the consumer.
            if (newFetcher != null)
            {
                _log.Debug("{0} Received new fetcher. Fetcher: {1}. Subscribing to this fetcher.", this, newFetcher);
                _currentfetcherSubscription = newFetcher.Subscribe(this);
                newFetcher.PartitionsUpdated();
            }
        }