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;
}
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);
}
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());
}
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;
}
Aggregations