Search in sources :

Example 1 with AlterConfigsResource

use of org.apache.kafka.common.message.IncrementalAlterConfigsRequestData.AlterConfigsResource in project kafka by apache.

the class IncrementalAlterConfigsRequest method getErrorResponse.

@Override
public AbstractResponse getErrorResponse(final int throttleTimeMs, final Throwable e) {
    IncrementalAlterConfigsResponseData response = new IncrementalAlterConfigsResponseData();
    ApiError apiError = ApiError.fromThrowable(e);
    for (AlterConfigsResource resource : data.resources()) {
        response.responses().add(new AlterConfigsResourceResponse().setResourceName(resource.resourceName()).setResourceType(resource.resourceType()).setErrorCode(apiError.error().code()).setErrorMessage(apiError.message()));
    }
    return new IncrementalAlterConfigsResponse(response);
}
Also used : IncrementalAlterConfigsResponseData(org.apache.kafka.common.message.IncrementalAlterConfigsResponseData) AlterConfigsResourceResponse(org.apache.kafka.common.message.IncrementalAlterConfigsResponseData.AlterConfigsResourceResponse) AlterConfigsResource(org.apache.kafka.common.message.IncrementalAlterConfigsRequestData.AlterConfigsResource)

Example 2 with AlterConfigsResource

use of org.apache.kafka.common.message.IncrementalAlterConfigsRequestData.AlterConfigsResource in project kafka by apache.

the class RequestResponseTest method createIncrementalAlterConfigsRequest.

private IncrementalAlterConfigsRequest createIncrementalAlterConfigsRequest(short version) {
    IncrementalAlterConfigsRequestData data = new IncrementalAlterConfigsRequestData();
    AlterableConfig alterableConfig = new AlterableConfig().setName("retention.ms").setConfigOperation((byte) 0).setValue("100");
    IncrementalAlterConfigsRequestData.AlterableConfigCollection alterableConfigs = new IncrementalAlterConfigsRequestData.AlterableConfigCollection();
    alterableConfigs.add(alterableConfig);
    data.resources().add(new AlterConfigsResource().setResourceName("testtopic").setResourceType(ResourceType.TOPIC.code()).setConfigs(alterableConfigs));
    return new IncrementalAlterConfigsRequest.Builder(data).build(version);
}
Also used : AlterableConfig(org.apache.kafka.common.message.IncrementalAlterConfigsRequestData.AlterableConfig) IncrementalAlterConfigsRequestData(org.apache.kafka.common.message.IncrementalAlterConfigsRequestData) AlterConfigsResource(org.apache.kafka.common.message.IncrementalAlterConfigsRequestData.AlterConfigsResource)

Aggregations

AlterConfigsResource (org.apache.kafka.common.message.IncrementalAlterConfigsRequestData.AlterConfigsResource)2 IncrementalAlterConfigsRequestData (org.apache.kafka.common.message.IncrementalAlterConfigsRequestData)1 AlterableConfig (org.apache.kafka.common.message.IncrementalAlterConfigsRequestData.AlterableConfig)1 IncrementalAlterConfigsResponseData (org.apache.kafka.common.message.IncrementalAlterConfigsResponseData)1 AlterConfigsResourceResponse (org.apache.kafka.common.message.IncrementalAlterConfigsResponseData.AlterConfigsResourceResponse)1