use of org.apache.kafka.common.message.MetadataResponseData.MetadataResponseBroker in project kafka by apache.
the class MetadataResponse method prepareResponse.
// Visible for testing
public static MetadataResponse prepareResponse(boolean hasReliableEpoch, int throttleTimeMs, Collection<Node> brokers, String clusterId, int controllerId, List<MetadataResponseTopic> topics, int clusterAuthorizedOperations) {
MetadataResponseData responseData = new MetadataResponseData();
responseData.setThrottleTimeMs(throttleTimeMs);
brokers.forEach(broker -> responseData.brokers().add(new MetadataResponseBroker().setNodeId(broker.id()).setHost(broker.host()).setPort(broker.port()).setRack(broker.rack())));
responseData.setClusterId(clusterId);
responseData.setControllerId(controllerId);
responseData.setClusterAuthorizedOperations(clusterAuthorizedOperations);
topics.forEach(topicMetadata -> responseData.topics().add(topicMetadata));
return new MetadataResponse(responseData, hasReliableEpoch);
}
Aggregations