Search in sources :

Example 1 with SchemaRegistryConfig

use of io.confluent.kafkarest.config.SchemaRegistryConfig in project kafka-rest by confluentinc.

the class DefaultKafkaRestContext method getSchemaRegistryClient.

@Override
public SchemaRegistryClient getSchemaRegistryClient() {
    if (!config.isSchemaRegistryEnabled()) {
        return null;
    }
    if (schemaRegistryClient == null) {
        SchemaRegistryConfig schemaRegistryConfig = new SchemaRegistryConfig(config.getSchemaRegistryConfigs());
        List<String> schemaRegistryUrls = schemaRegistryConfig.getSchemaRegistryUrls().stream().map(URI::create).map(Object::toString).collect(Collectors.toList());
        schemaRegistryClient = new CachedSchemaRegistryClient(schemaRegistryUrls, schemaRegistryConfig.getMaxSchemasPerSubject(), SCHEMA_PROVIDERS, config.getSchemaRegistryConfigs(), schemaRegistryConfig.requestHeaders());
    }
    return schemaRegistryClient;
}
Also used : SchemaRegistryConfig(io.confluent.kafkarest.config.SchemaRegistryConfig) CachedSchemaRegistryClient(io.confluent.kafka.schemaregistry.client.CachedSchemaRegistryClient) URI(java.net.URI)

Aggregations

CachedSchemaRegistryClient (io.confluent.kafka.schemaregistry.client.CachedSchemaRegistryClient)1 SchemaRegistryConfig (io.confluent.kafkarest.config.SchemaRegistryConfig)1 URI (java.net.URI)1