use of org.apache.kafka.common.message.CreatePartitionsResponseData in project kafka by apache.
the class RequestResponseTest method createCreatePartitionsResponse.
private CreatePartitionsResponse createCreatePartitionsResponse() {
List<CreatePartitionsTopicResult> results = new LinkedList<>();
results.add(new CreatePartitionsTopicResult().setName("my_topic").setErrorCode(Errors.INVALID_REPLICA_ASSIGNMENT.code()));
results.add(new CreatePartitionsTopicResult().setName("my_topic").setErrorCode(Errors.NONE.code()));
CreatePartitionsResponseData data = new CreatePartitionsResponseData().setThrottleTimeMs(42).setResults(results);
return new CreatePartitionsResponse(data);
}
use of org.apache.kafka.common.message.CreatePartitionsResponseData in project kafka by apache.
the class CreatePartitionsRequest method getErrorResponse.
@Override
public AbstractResponse getErrorResponse(int throttleTimeMs, Throwable e) {
CreatePartitionsResponseData response = new CreatePartitionsResponseData();
response.setThrottleTimeMs(throttleTimeMs);
ApiError apiError = ApiError.fromThrowable(e);
for (CreatePartitionsTopic topic : data.topics()) {
response.results().add(new CreatePartitionsTopicResult().setName(topic.name()).setErrorCode(apiError.error().code()).setErrorMessage(apiError.message()));
}
return new CreatePartitionsResponse(response);
}
Aggregations