Search in sources :

Example 1 with MetadataResponseBroker

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);
}
Also used : MetadataResponseBroker(org.apache.kafka.common.message.MetadataResponseData.MetadataResponseBroker) MetadataResponseData(org.apache.kafka.common.message.MetadataResponseData)

Aggregations

MetadataResponseData (org.apache.kafka.common.message.MetadataResponseData)1 MetadataResponseBroker (org.apache.kafka.common.message.MetadataResponseData.MetadataResponseBroker)1