Search in sources :

Example 1 with ConfigUpdateRequest

use of io.confluent.kafka.schemaregistry.client.rest.entities.requests.ConfigUpdateRequest in project schema-registry by confluentinc.

the class SchemaRegistryPerformance method init.

protected void init() throws Exception {
    // No compatibility verification
    ConfigUpdateRequest request = new ConfigUpdateRequest();
    request.setCompatibilityLevel(CompatibilityLevel.NONE.name);
    restService.updateConfig(request, null);
}
Also used : ConfigUpdateRequest(io.confluent.kafka.schemaregistry.client.rest.entities.requests.ConfigUpdateRequest)

Example 2 with ConfigUpdateRequest

use of io.confluent.kafka.schemaregistry.client.rest.entities.requests.ConfigUpdateRequest 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)

Example 3 with ConfigUpdateRequest

use of io.confluent.kafka.schemaregistry.client.rest.entities.requests.ConfigUpdateRequest in project schema-registry by confluentinc.

the class RestService method updateCompatibility.

public ConfigUpdateRequest updateCompatibility(String compatibility, String subject) throws IOException, RestClientException {
    ConfigUpdateRequest request = new ConfigUpdateRequest();
    request.setCompatibilityLevel(compatibility);
    return updateConfig(request, subject);
}
Also used : ConfigUpdateRequest(io.confluent.kafka.schemaregistry.client.rest.entities.requests.ConfigUpdateRequest)

Example 4 with ConfigUpdateRequest

use of io.confluent.kafka.schemaregistry.client.rest.entities.requests.ConfigUpdateRequest in project schema-registry by confluentinc.

the class RestService method updateConfig.

/**
 * On success, this api simply echoes the request in the response.
 */
public ConfigUpdateRequest updateConfig(Map<String, String> requestProperties, ConfigUpdateRequest configUpdateRequest, String subject) throws IOException, RestClientException {
    String path = subject != null ? UriBuilder.fromPath("/config/{subject}").build(subject).toString() : "/config";
    ConfigUpdateRequest response = httpRequest(path, "PUT", configUpdateRequest.toJson().getBytes(StandardCharsets.UTF_8), requestProperties, UPDATE_CONFIG_RESPONSE_TYPE_REFERENCE);
    return response;
}
Also used : ConfigUpdateRequest(io.confluent.kafka.schemaregistry.client.rest.entities.requests.ConfigUpdateRequest) SchemaString(io.confluent.kafka.schemaregistry.client.rest.entities.SchemaString)

Aggregations

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