Search in sources :

Example 6 with AvroSchemaProvider

use of io.confluent.kafka.schemaregistry.avro.AvroSchemaProvider in project akhq by tchiotludo.

the class KafkaModule method getAvroSchemaProvider.

public AvroSchemaProvider getAvroSchemaProvider(String clusterId) {
    AvroSchemaProvider avroSchemaProvider = new AvroSchemaProvider();
    avroSchemaProvider.configure(Collections.singletonMap("schemaVersionFetcher", new CachedSchemaRegistryClient(this.getRegistryRestClient(clusterId), 1000)));
    return avroSchemaProvider;
}
Also used : CachedSchemaRegistryClient(io.confluent.kafka.schemaregistry.client.CachedSchemaRegistryClient) AvroSchemaProvider(io.confluent.kafka.schemaregistry.avro.AvroSchemaProvider)

Example 7 with AvroSchemaProvider

use of io.confluent.kafka.schemaregistry.avro.AvroSchemaProvider in project akhq by tchiotludo.

the class KafkaModule method getRegistryClient.

public SchemaRegistryClient getRegistryClient(String clusterId) {
    if (!this.registryClient.containsKey(clusterId)) {
        Connection connection = this.getConnection(clusterId);
        List<SchemaProvider> providers = new ArrayList<>();
        providers.add(new AvroSchemaProvider());
        providers.add(new JsonSchemaProvider());
        providers.add(new ProtobufSchemaProvider());
        SchemaRegistryClient client = new CachedSchemaRegistryClient(this.getRegistryRestClient(clusterId), 1000, providers, connection.getSchemaRegistry() != null ? connection.getSchemaRegistry().getProperties() : null, null);
        this.registryClient.put(clusterId, client);
    }
    return this.registryClient.get(clusterId);
}
Also used : JsonSchemaProvider(io.confluent.kafka.schemaregistry.json.JsonSchemaProvider) Connection(org.akhq.configs.Connection) ProtobufSchemaProvider(io.confluent.kafka.schemaregistry.protobuf.ProtobufSchemaProvider) SchemaProvider(io.confluent.kafka.schemaregistry.SchemaProvider) JsonSchemaProvider(io.confluent.kafka.schemaregistry.json.JsonSchemaProvider) AvroSchemaProvider(io.confluent.kafka.schemaregistry.avro.AvroSchemaProvider) ProtobufSchemaProvider(io.confluent.kafka.schemaregistry.protobuf.ProtobufSchemaProvider) CachedSchemaRegistryClient(io.confluent.kafka.schemaregistry.client.CachedSchemaRegistryClient) AvroSchemaProvider(io.confluent.kafka.schemaregistry.avro.AvroSchemaProvider) SchemaRegistryClient(io.confluent.kafka.schemaregistry.client.SchemaRegistryClient) CachedSchemaRegistryClient(io.confluent.kafka.schemaregistry.client.CachedSchemaRegistryClient)

Example 8 with AvroSchemaProvider

use of io.confluent.kafka.schemaregistry.avro.AvroSchemaProvider in project kafka-rest by confluentinc.

the class SchemaRegistryFixture method beforeEach.

@Override
public void beforeEach(ExtensionContext extensionContext) throws Exception {
    checkState(server == null);
    server = new SchemaRegistryRestApplication(createConfigs()).createServer();
    server.start();
    baseUri = server.getURI();
    client = new CachedSchemaRegistryClient(singletonList(baseUri.toString()), MAX_SCHEMAS_PER_SUBJECT_DEFAULT, Arrays.asList(new AvroSchemaProvider(), new JsonSchemaProvider(), new ProtobufSchemaProvider()), getClientConfigs());
}
Also used : SchemaRegistryRestApplication(io.confluent.kafka.schemaregistry.rest.SchemaRegistryRestApplication) JsonSchemaProvider(io.confluent.kafka.schemaregistry.json.JsonSchemaProvider) CachedSchemaRegistryClient(io.confluent.kafka.schemaregistry.client.CachedSchemaRegistryClient) ProtobufSchemaProvider(io.confluent.kafka.schemaregistry.protobuf.ProtobufSchemaProvider) AvroSchemaProvider(io.confluent.kafka.schemaregistry.avro.AvroSchemaProvider)

Example 9 with AvroSchemaProvider

use of io.confluent.kafka.schemaregistry.avro.AvroSchemaProvider in project schema-registry by confluentinc.

the class KafkaSchemaRegistry method initProviders.

private Map<String, SchemaProvider> initProviders(SchemaRegistryConfig config) {
    Map<String, Object> schemaProviderConfigs = config.originalsWithPrefix(SchemaRegistryConfig.SCHEMA_PROVIDERS_CONFIG + ".");
    schemaProviderConfigs.put(SchemaProvider.SCHEMA_VERSION_FETCHER_CONFIG, this);
    List<SchemaProvider> defaultSchemaProviders = Arrays.asList(new AvroSchemaProvider(), new JsonSchemaProvider(), new ProtobufSchemaProvider());
    for (SchemaProvider provider : defaultSchemaProviders) {
        provider.configure(schemaProviderConfigs);
    }
    Map<String, SchemaProvider> providerMap = new HashMap<>();
    registerProviders(providerMap, defaultSchemaProviders);
    List<SchemaProvider> customSchemaProviders = config.getConfiguredInstances(SchemaRegistryConfig.SCHEMA_PROVIDERS_CONFIG, SchemaProvider.class, schemaProviderConfigs);
    // Allow custom providers to override default providers
    registerProviders(providerMap, customSchemaProviders);
    metricsContainer.getCustomSchemaProviderCount().set(customSchemaProviders.size());
    return providerMap;
}
Also used : ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) JsonSchemaProvider(io.confluent.kafka.schemaregistry.json.JsonSchemaProvider) ProtobufSchemaProvider(io.confluent.kafka.schemaregistry.protobuf.ProtobufSchemaProvider) SchemaProvider(io.confluent.kafka.schemaregistry.SchemaProvider) JsonSchemaProvider(io.confluent.kafka.schemaregistry.json.JsonSchemaProvider) AvroSchemaProvider(io.confluent.kafka.schemaregistry.avro.AvroSchemaProvider) SchemaString(io.confluent.kafka.schemaregistry.client.rest.entities.SchemaString) ProtobufSchemaProvider(io.confluent.kafka.schemaregistry.protobuf.ProtobufSchemaProvider) AvroSchemaProvider(io.confluent.kafka.schemaregistry.avro.AvroSchemaProvider)

Aggregations

AvroSchemaProvider (io.confluent.kafka.schemaregistry.avro.AvroSchemaProvider)9 CachedSchemaRegistryClient (io.confluent.kafka.schemaregistry.client.CachedSchemaRegistryClient)5 JsonSchemaProvider (io.confluent.kafka.schemaregistry.json.JsonSchemaProvider)4 ProtobufSchemaProvider (io.confluent.kafka.schemaregistry.protobuf.ProtobufSchemaProvider)4 SchemaProvider (io.confluent.kafka.schemaregistry.SchemaProvider)2 SchemaRegistryClient (io.confluent.kafka.schemaregistry.client.SchemaRegistryClient)2 ParsedSchema (io.confluent.kafka.schemaregistry.ParsedSchema)1 RestService (io.confluent.kafka.schemaregistry.client.rest.RestService)1 SchemaString (io.confluent.kafka.schemaregistry.client.rest.entities.SchemaString)1 SchemaRegistryRestApplication (io.confluent.kafka.schemaregistry.rest.SchemaRegistryRestApplication)1 AbstractKafkaAvroDeserializer (io.confluent.kafka.serializers.AbstractKafkaAvroDeserializer)1 AbstractKafkaAvroSerializer (io.confluent.kafka.serializers.AbstractKafkaAvroSerializer)1 HashMap (java.util.HashMap)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 Connection (org.akhq.configs.Connection)1 Test (org.junit.Test)1