use of io.confluent.rest.exceptions.RestException in project schema-registry by confluentinc.
the class KafkaSchemaRegistry method forwardDeleteCompatibilityConfigToLeader.
private void forwardDeleteCompatibilityConfigToLeader(Map<String, String> requestProperties, String subject) throws SchemaRegistryRequestForwardingException {
UrlList baseUrl = leaderRestService.getBaseUrls();
log.debug(String.format("Forwarding delete subject compatibility config request %s to %s", subject, baseUrl));
try {
leaderRestService.deleteConfig(requestProperties, subject);
} catch (IOException e) {
throw new SchemaRegistryRequestForwardingException(String.format("Unexpected error while forwarding delete subject compatibility config" + "request %s to %s", subject, baseUrl), e);
} catch (RestClientException e) {
throw new RestException(e.getMessage(), e.getStatus(), e.getErrorCode(), e);
}
}
use of io.confluent.rest.exceptions.RestException in project schema-registry by confluentinc.
the class KafkaSchemaRegistry method forwardUpdateCompatibilityLevelRequestToLeader.
private void forwardUpdateCompatibilityLevelRequestToLeader(String subject, CompatibilityLevel compatibilityLevel, Map<String, String> headerProperties) throws SchemaRegistryRequestForwardingException {
UrlList baseUrl = leaderRestService.getBaseUrls();
ConfigUpdateRequest configUpdateRequest = new ConfigUpdateRequest();
configUpdateRequest.setCompatibilityLevel(compatibilityLevel.name);
log.debug(String.format("Forwarding update config request %s to %s", configUpdateRequest, baseUrl));
try {
leaderRestService.updateConfig(headerProperties, configUpdateRequest, subject);
} catch (IOException e) {
throw new SchemaRegistryRequestForwardingException(String.format("Unexpected error while forwarding the update config request %s to %s", configUpdateRequest, baseUrl), e);
} catch (RestClientException e) {
throw new RestException(e.getMessage(), e.getStatus(), e.getErrorCode(), e);
}
}
Aggregations