use of org.apache.kafka.common.message.DeleteTopicsResponseData in project kafka by apache.
the class DeleteTopicsRequest method getErrorResponse.
@Override
public AbstractResponse getErrorResponse(int throttleTimeMs, Throwable e) {
DeleteTopicsResponseData response = new DeleteTopicsResponseData();
if (version() >= 1) {
response.setThrottleTimeMs(throttleTimeMs);
}
ApiError apiError = ApiError.fromThrowable(e);
for (DeleteTopicState topic : topics()) {
response.responses().add(new DeletableTopicResult().setName(topic.name()).setTopicId(topic.topicId()).setErrorCode(apiError.error().code()));
}
return new DeleteTopicsResponse(response);
}
use of org.apache.kafka.common.message.DeleteTopicsResponseData in project kafka by apache.
the class KafkaAdminClientTest method prepareDeleteTopicsResponseWithTopicId.
private static DeleteTopicsResponse prepareDeleteTopicsResponseWithTopicId(Uuid id, Errors error) {
DeleteTopicsResponseData data = new DeleteTopicsResponseData();
data.responses().add(new DeletableTopicResult().setTopicId(id).setErrorCode(error.code()));
return new DeleteTopicsResponse(data);
}
use of org.apache.kafka.common.message.DeleteTopicsResponseData in project kafka by apache.
the class KafkaAdminClientTest method prepareDeleteTopicsResponse.
private static DeleteTopicsResponse prepareDeleteTopicsResponse(String topicName, Errors error) {
DeleteTopicsResponseData data = new DeleteTopicsResponseData();
data.responses().add(new DeletableTopicResult().setName(topicName).setErrorCode(error.code()));
return new DeleteTopicsResponse(data);
}
use of org.apache.kafka.common.message.DeleteTopicsResponseData in project kafka by apache.
the class RequestResponseTest method createDeleteTopicsResponse.
private DeleteTopicsResponse createDeleteTopicsResponse() {
DeleteTopicsResponseData data = new DeleteTopicsResponseData();
data.responses().add(new DeletableTopicResult().setName("t1").setErrorCode(Errors.INVALID_TOPIC_EXCEPTION.code()).setErrorMessage("Error Message"));
data.responses().add(new DeletableTopicResult().setName("t2").setErrorCode(Errors.TOPIC_AUTHORIZATION_FAILED.code()).setErrorMessage("Error Message"));
data.responses().add(new DeletableTopicResult().setName("t3").setErrorCode(Errors.NOT_CONTROLLER.code()));
data.responses().add(new DeletableTopicResult().setName("t4").setErrorCode(Errors.NONE.code()));
return new DeleteTopicsResponse(data);
}
Aggregations