protected synchronized SchemaRegistryClient getClient() { if (!initialized) { schemaRegistryClient = new SchemaRegistryClient(schemaRegistryConfig); initialized = true; } return schemaRegistryClient; }
public SampleSchemaRegistryClientApp(Map<String, Object> config) { this.config = config; schemaRegistryClient = new SchemaRegistryClient(config); }
@Override public void configure(Map<String, ?> configs, boolean isKey) { // ignoring the isKey since this class is expected to be used only as a value serializer for now, value being StreamlineEvent avroSnapshotSerializer.init(configs); schemaRegistryClient = new SchemaRegistryClient(configs); String writerSchemaVersion = (String) configs.get("writer.schema.version"); if (writerSchemaVersion != null && !writerSchemaVersion.isEmpty()) { this.writerSchemaVersion = Integer.parseInt(writerSchemaVersion); } else { this.writerSchemaVersion = null; } }
private SchemaRegistryClient createSchemaRegistryClient() { Map<String, ?> conf = Collections.singletonMap(SchemaRegistryClient.Configuration.SCHEMA_REGISTRY_URL.name(), config.get("schemaRegistryUrl")); return new SchemaRegistryClient(conf); }
public final void init(Map<String, ?> config) { if (closed) { throw new IllegalStateException("Closed instance can not be initialized again"); } if (initialized) { LOG.info("This instance [{}] is already inited", this); return; } LOG.debug("Initialized with config: [{}]", config); if (schemaRegistryClient == null) { schemaRegistryClient = new SchemaRegistryClient(config); } doInit(config); initialized = true; }
public SchemaRegistryClient getClient(boolean cached) throws IOException { if (!cached) { SchemaRegistryClient schemaRegistryClient = new SchemaRegistryClient(exportClientConf(false)); if (cachedSchemaRegistryClient == null) { cachedSchemaRegistryClient = schemaRegistryClient; } return schemaRegistryClient; } else { if (cachedSchemaRegistryClient == null) { cachedSchemaRegistryClient = new SchemaRegistryClient(exportClientConf(true)); } return cachedSchemaRegistryClient; } }
@Override public void run(ReviewServiceConfig config, Environment environment) throws Exception { SchemaRegistryClient schemaRegistryClient = new SchemaRegistryClient(createConfig(config.getSchemaRegistryUrl())); environment.jersey().register(new ReviewServiceResource(schemaRegistryClient)); }