Search in sources :

Example 1 with TopicRequest

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

the class DescribeProducersRequest method getErrorResponse.

@Override
public DescribeProducersResponse getErrorResponse(int throttleTimeMs, Throwable e) {
    Errors error = Errors.forException(e);
    DescribeProducersResponseData response = new DescribeProducersResponseData();
    for (TopicRequest topicRequest : data.topics()) {
        TopicResponse topicResponse = new TopicResponse().setName(topicRequest.name());
        for (int partitionId : topicRequest.partitionIndexes()) {
            topicResponse.partitions().add(new PartitionResponse().setPartitionIndex(partitionId).setErrorCode(error.code()));
        }
        response.topics().add(topicResponse);
    }
    return new DescribeProducersResponse(response);
}
Also used : Errors(org.apache.kafka.common.protocol.Errors) PartitionResponse(org.apache.kafka.common.message.DescribeProducersResponseData.PartitionResponse) TopicRequest(org.apache.kafka.common.message.DescribeProducersRequestData.TopicRequest) TopicResponse(org.apache.kafka.common.message.DescribeProducersResponseData.TopicResponse) DescribeProducersResponseData(org.apache.kafka.common.message.DescribeProducersResponseData)

Aggregations

TopicRequest (org.apache.kafka.common.message.DescribeProducersRequestData.TopicRequest)1 DescribeProducersResponseData (org.apache.kafka.common.message.DescribeProducersResponseData)1 PartitionResponse (org.apache.kafka.common.message.DescribeProducersResponseData.PartitionResponse)1 TopicResponse (org.apache.kafka.common.message.DescribeProducersResponseData.TopicResponse)1 Errors (org.apache.kafka.common.protocol.Errors)1