Search in sources :

Example 1 with DeleteTopicsResponseData

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);
}
Also used : DeleteTopicsResponseData(org.apache.kafka.common.message.DeleteTopicsResponseData) DeleteTopicState(org.apache.kafka.common.message.DeleteTopicsRequestData.DeleteTopicState) DeletableTopicResult(org.apache.kafka.common.message.DeleteTopicsResponseData.DeletableTopicResult)

Example 2 with DeleteTopicsResponseData

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);
}
Also used : DeleteTopicsResponse(org.apache.kafka.common.requests.DeleteTopicsResponse) DeleteTopicsResponseData(org.apache.kafka.common.message.DeleteTopicsResponseData) DeletableTopicResult(org.apache.kafka.common.message.DeleteTopicsResponseData.DeletableTopicResult)

Example 3 with DeleteTopicsResponseData

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);
}
Also used : DeleteTopicsResponse(org.apache.kafka.common.requests.DeleteTopicsResponse) DeleteTopicsResponseData(org.apache.kafka.common.message.DeleteTopicsResponseData) DeletableTopicResult(org.apache.kafka.common.message.DeleteTopicsResponseData.DeletableTopicResult)

Example 4 with DeleteTopicsResponseData

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);
}
Also used : DeleteTopicsResponseData(org.apache.kafka.common.message.DeleteTopicsResponseData) DeletableTopicResult(org.apache.kafka.common.message.DeleteTopicsResponseData.DeletableTopicResult)

Aggregations

DeleteTopicsResponseData (org.apache.kafka.common.message.DeleteTopicsResponseData)4 DeletableTopicResult (org.apache.kafka.common.message.DeleteTopicsResponseData.DeletableTopicResult)4 DeleteTopicsResponse (org.apache.kafka.common.requests.DeleteTopicsResponse)2 DeleteTopicState (org.apache.kafka.common.message.DeleteTopicsRequestData.DeleteTopicState)1