Search in sources :

Example 6 with UrlList

use of io.confluent.kafka.schemaregistry.client.rest.utils.UrlList 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);
    }
}
Also used : SchemaRegistryRequestForwardingException(io.confluent.kafka.schemaregistry.exceptions.SchemaRegistryRequestForwardingException) RestClientException(io.confluent.kafka.schemaregistry.client.rest.exceptions.RestClientException) RestException(io.confluent.rest.exceptions.RestException) IOException(java.io.IOException) UrlList(io.confluent.kafka.schemaregistry.client.rest.utils.UrlList)

Example 7 with UrlList

use of io.confluent.kafka.schemaregistry.client.rest.utils.UrlList 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);
    }
}
Also used : SchemaRegistryRequestForwardingException(io.confluent.kafka.schemaregistry.exceptions.SchemaRegistryRequestForwardingException) ConfigUpdateRequest(io.confluent.kafka.schemaregistry.client.rest.entities.requests.ConfigUpdateRequest) RestClientException(io.confluent.kafka.schemaregistry.client.rest.exceptions.RestClientException) RestException(io.confluent.rest.exceptions.RestException) IOException(java.io.IOException) UrlList(io.confluent.kafka.schemaregistry.client.rest.utils.UrlList)

Aggregations

RestClientException (io.confluent.kafka.schemaregistry.client.rest.exceptions.RestClientException)7 UrlList (io.confluent.kafka.schemaregistry.client.rest.utils.UrlList)7 SchemaRegistryRequestForwardingException (io.confluent.kafka.schemaregistry.exceptions.SchemaRegistryRequestForwardingException)7 RestException (io.confluent.rest.exceptions.RestException)7 IOException (java.io.IOException)7 ConfigUpdateRequest (io.confluent.kafka.schemaregistry.client.rest.entities.requests.ConfigUpdateRequest)1 ModeUpdateRequest (io.confluent.kafka.schemaregistry.client.rest.entities.requests.ModeUpdateRequest)1 RegisterSchemaRequest (io.confluent.kafka.schemaregistry.client.rest.entities.requests.RegisterSchemaRequest)1