Search in sources :

Example 1 with DescribeProducersRequestData

use of org.apache.kafka.common.message.DescribeProducersRequestData in project kafka by apache.

the class RequestResponseTest method createDescribeProducersRequest.

private DescribeProducersRequest createDescribeProducersRequest(short version) {
    DescribeProducersRequestData data = new DescribeProducersRequestData();
    DescribeProducersRequestData.TopicRequest topicRequest = new DescribeProducersRequestData.TopicRequest();
    topicRequest.setName("test");
    topicRequest.partitionIndexes().add(0);
    topicRequest.partitionIndexes().add(1);
    data.topics().add(topicRequest);
    return new DescribeProducersRequest.Builder(data).build(version);
}
Also used : DescribeProducersRequestData(org.apache.kafka.common.message.DescribeProducersRequestData)

Example 2 with DescribeProducersRequestData

use of org.apache.kafka.common.message.DescribeProducersRequestData in project kafka by apache.

the class DescribeProducersHandler method buildRequest.

@Override
public DescribeProducersRequest.Builder buildRequest(int brokerId, Set<TopicPartition> topicPartitions) {
    DescribeProducersRequestData request = new DescribeProducersRequestData();
    DescribeProducersRequest.Builder builder = new DescribeProducersRequest.Builder(request);
    CollectionUtils.groupPartitionsByTopic(topicPartitions, builder::addTopic, (topicRequest, partitionId) -> topicRequest.partitionIndexes().add(partitionId));
    return builder;
}
Also used : DescribeProducersRequest(org.apache.kafka.common.requests.DescribeProducersRequest) DescribeProducersRequestData(org.apache.kafka.common.message.DescribeProducersRequestData)

Aggregations

DescribeProducersRequestData (org.apache.kafka.common.message.DescribeProducersRequestData)2 DescribeProducersRequest (org.apache.kafka.common.requests.DescribeProducersRequest)1