KafkaNet.BrokerRouter.RefreshMissingTopicMetadata C# (CSharp) Method

RefreshMissingTopicMetadata() public method

public RefreshMissingTopicMetadata ( ) : Task
return Task
        public async Task RefreshMissingTopicMetadata(params string[] topics)
        {
            var topicSearchResult = SearchCacheForTopics(topics, null);

            //update metadata for all missing topics
            if (topicSearchResult.Missing.Count > 0)
            {
                //double check for missing topics and query
                await RefreshTopicMetadata(null, _kafkaOptions.RefreshMetadataTimeout, topicSearchResult.Missing.Where(x => _topicIndex.ContainsKey(x) == false).ToArray()).ConfigureAwait(false);
            }
        }

Usage Example

        public async Task BrokerRouterUsesFactoryToAddNewBrokers()
        {
            var router = new BrokerRouter(new KafkaOptions
            {
                KafkaServerUri = new List<Uri> { new Uri("http://localhost:1") },
                KafkaConnectionFactory = _mockKafkaConnectionFactory.Object
            });

            _mockKafkaConnection1.Setup(x => x.SendAsync(It.IsAny<IKafkaRequest<MetadataResponse>>()))
                      .Returns(() => Task.Run(async () => new List<MetadataResponse> { await BrokerRouterProxy.CreateMetadataResponseWithMultipleBrokers() }));
            await router.RefreshMissingTopicMetadata(TestTopic);
            var topics = router.GetTopicMetadataFromLocalCache(TestTopic);
            _mockKafkaConnectionFactory.Verify(x => x.Create(It.Is<KafkaEndpoint>(e => e.Endpoint.Port == 2), It.IsAny<TimeSpan>(), It.IsAny<IKafkaLog>(), It.IsAny<int>(), It.IsAny<TimeSpan?>(), It.IsAny<StatisticsTrackerOptions>()), Times.Once());
        }
All Usage Examples Of KafkaNet.BrokerRouter::RefreshMissingTopicMetadata