use of io.confluent.kafka.schemaregistry.client.CachedSchemaRegistryClient in project flink by apache.
the class CachedSchemaCoderProviderTest method getInternalStateFromRestService.
private <T> T getInternalStateFromRestService(String name, CachedSchemaCoderProvider provider) {
CachedSchemaRegistryClient cachedSchemaRegistryClient = Whitebox.getInternalState(provider.get(), "schemaRegistryClient");
RestService restService = Whitebox.getInternalState(cachedSchemaRegistryClient, "restService");
return Whitebox.getInternalState(restService, name);
}
use of io.confluent.kafka.schemaregistry.client.CachedSchemaRegistryClient 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;
}
use of io.confluent.kafka.schemaregistry.client.CachedSchemaRegistryClient in project flink-mirror by flink-ci.
the class CachedSchemaCoderProviderTest method getInternalStateFromRestService.
private <T> T getInternalStateFromRestService(String name, CachedSchemaCoderProvider provider) {
CachedSchemaRegistryClient cachedSchemaRegistryClient = Whitebox.getInternalState(provider.get(), "schemaRegistryClient");
RestService restService = Whitebox.getInternalState(cachedSchemaRegistryClient, "restService");
return Whitebox.getInternalState(restService, name);
}
use of io.confluent.kafka.schemaregistry.client.CachedSchemaRegistryClient in project apicurio-registry by Apicurio.
the class ClusteredRegistryIT method testConfluent.
@Test
public void testConfluent() throws Exception {
SchemaRegistryClient client1 = new CachedSchemaRegistryClient("http://localhost:" + TestUtils.getRegistryPort() + "/apis/ccompat/v6", 3);
int node2port = TestUtils.getRegistryPort() + 1;
SchemaRegistryClient client2 = new CachedSchemaRegistryClient("http://localhost:" + node2port + "/apis/ccompat/v6", 3);
String subject = UUID.randomUUID().toString();
ParsedSchema schema = new AvroSchema("{\"type\":\"record\",\"name\":\"myrecord1\",\"fields\":[{\"name\":\"f1\",\"type\":\"string\"}]}");
int id = client1.register(subject, schema);
try {
TestUtils.retry(() -> {
Collection<String> allSubjects = client2.getAllSubjects();
Assertions.assertTrue(allSubjects.contains(subject));
}, "ClusterIT-SmokeTest-RegisterSchema-1", 10);
TestUtils.retry(() -> {
ParsedSchema s = client2.getSchemaById(id);
Assertions.assertNotNull(s);
}, "ClusterIT-SmokeTest-RegisterSchema-2", 10);
} finally {
client1.deleteSchemaVersion(subject, "1");
}
}
use of io.confluent.kafka.schemaregistry.client.CachedSchemaRegistryClient in project flink by splunk.
the class CachedSchemaCoderProviderTest method getInternalStateFromRestService.
private <T> T getInternalStateFromRestService(String name, CachedSchemaCoderProvider provider) {
CachedSchemaRegistryClient cachedSchemaRegistryClient = Whitebox.getInternalState(provider.get(), "schemaRegistryClient");
RestService restService = Whitebox.getInternalState(cachedSchemaRegistryClient, "restService");
return Whitebox.getInternalState(restService, name);
}
Aggregations