while (i < brokers.size() && !fetchMetaDataSucceeded) {
SimpleConsumer consumer = createConsumer(context, brokers.get(i));
log.info(String.format("Fetching metadata from broker %s with client id %s for %d topic(s) %s",
brokers.get(i), consumer.clientId(), metaRequestTopics.size(), metaRequestTopics));
try {
topicMetadataList = consumer.send(new TopicMetadataRequest(metaRequestTopics)).topicsMetadata();
fetchMetaDataSucceeded = true;
} catch (Exception e) {
savedException = e;
log.warn(String.format("Fetching topic metadata with client id %s for topics [%s] from broker [%s] failed",
consumer.clientId(), metaRequestTopics, brokers.get(i)), e);