Search in sources :

Example 1 with UpdatableFeatureResultCollection

use of org.apache.kafka.common.message.UpdateFeaturesResponseData.UpdatableFeatureResultCollection in project kafka by apache.

the class UpdateFeaturesResponse method createWithErrors.

public static UpdateFeaturesResponse createWithErrors(ApiError topLevelError, Map<String, ApiError> updateErrors, int throttleTimeMs) {
    final UpdatableFeatureResultCollection results = new UpdatableFeatureResultCollection();
    for (final Map.Entry<String, ApiError> updateError : updateErrors.entrySet()) {
        final String feature = updateError.getKey();
        final ApiError error = updateError.getValue();
        final UpdatableFeatureResult result = new UpdatableFeatureResult();
        result.setFeature(feature).setErrorCode(error.error().code()).setErrorMessage(error.message());
        results.add(result);
    }
    final UpdateFeaturesResponseData responseData = new UpdateFeaturesResponseData().setThrottleTimeMs(throttleTimeMs).setErrorCode(topLevelError.error().code()).setErrorMessage(topLevelError.message()).setResults(results).setThrottleTimeMs(throttleTimeMs);
    return new UpdateFeaturesResponse(responseData);
}
Also used : UpdateFeaturesResponseData(org.apache.kafka.common.message.UpdateFeaturesResponseData) UpdatableFeatureResultCollection(org.apache.kafka.common.message.UpdateFeaturesResponseData.UpdatableFeatureResultCollection) UpdatableFeatureResult(org.apache.kafka.common.message.UpdateFeaturesResponseData.UpdatableFeatureResult) Map(java.util.Map) HashMap(java.util.HashMap)

Aggregations

HashMap (java.util.HashMap)1 Map (java.util.Map)1 UpdateFeaturesResponseData (org.apache.kafka.common.message.UpdateFeaturesResponseData)1 UpdatableFeatureResult (org.apache.kafka.common.message.UpdateFeaturesResponseData.UpdatableFeatureResult)1 UpdatableFeatureResultCollection (org.apache.kafka.common.message.UpdateFeaturesResponseData.UpdatableFeatureResultCollection)1