Search in sources :

Example 1 with DescribeClusterBroker

use of org.apache.kafka.common.message.DescribeClusterResponseData.DescribeClusterBroker in project kafka by apache.

the class MessageTest method testDescribeClusterResponseVersions.

@Test
public void testDescribeClusterResponseVersions() throws Exception {
    DescribeClusterResponseData data = new DescribeClusterResponseData().setBrokers(new DescribeClusterBrokerCollection(Collections.singletonList(new DescribeClusterBroker().setBrokerId(1).setHost("localhost").setPort(9092).setRack("rack1")).iterator())).setClusterId("clusterId").setControllerId(1).setClusterAuthorizedOperations(10);
    testAllMessageRoundTrips(data);
}
Also used : DescribeClusterBrokerCollection(org.apache.kafka.common.message.DescribeClusterResponseData.DescribeClusterBrokerCollection) DescribeClusterBroker(org.apache.kafka.common.message.DescribeClusterResponseData.DescribeClusterBroker) Test(org.junit.jupiter.api.Test)

Example 2 with DescribeClusterBroker

use of org.apache.kafka.common.message.DescribeClusterResponseData.DescribeClusterBroker in project kafka by apache.

the class KafkaAdminClientTest method prepareDescribeClusterResponse.

private static DescribeClusterResponse prepareDescribeClusterResponse(int throttleTimeMs, Collection<Node> brokers, String clusterId, int controllerId, int clusterAuthorizedOperations) {
    DescribeClusterResponseData data = new DescribeClusterResponseData().setErrorCode(Errors.NONE.code()).setThrottleTimeMs(throttleTimeMs).setControllerId(controllerId).setClusterId(clusterId).setClusterAuthorizedOperations(clusterAuthorizedOperations);
    brokers.forEach(broker -> data.brokers().add(new DescribeClusterBroker().setHost(broker.host()).setPort(broker.port()).setBrokerId(broker.id()).setRack(broker.rack())));
    return new DescribeClusterResponse(data);
}
Also used : DescribeClusterResponseData(org.apache.kafka.common.message.DescribeClusterResponseData) DescribeClusterResponse(org.apache.kafka.common.requests.DescribeClusterResponse) DescribeClusterBroker(org.apache.kafka.common.message.DescribeClusterResponseData.DescribeClusterBroker)

Aggregations

DescribeClusterBroker (org.apache.kafka.common.message.DescribeClusterResponseData.DescribeClusterBroker)2 DescribeClusterResponseData (org.apache.kafka.common.message.DescribeClusterResponseData)1 DescribeClusterBrokerCollection (org.apache.kafka.common.message.DescribeClusterResponseData.DescribeClusterBrokerCollection)1 DescribeClusterResponse (org.apache.kafka.common.requests.DescribeClusterResponse)1 Test (org.junit.jupiter.api.Test)1