congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
SchemaRegistry.getLatestSchemaByTopic
Code IndexAdd Tabnine to your IDE (free)

How to use
getLatestSchemaByTopic
method
in
com.linkedin.camus.schemaregistry.SchemaRegistry

Best Java code snippets using com.linkedin.camus.schemaregistry.SchemaRegistry.getLatestSchemaByTopic (Showing top 6 results out of 315)

origin: linkedin/camus

public SchemaDetails<S> getLatestSchemaByTopic(String topicName) {
 SchemaDetails<S> schema = cachedLatest.get(topicName);
 if (schema == null) {
  schema = registry.getLatestSchemaByTopic(topicName);
  cachedLatest.putIfAbsent(topicName, schema);
 }
 return schema;
}
origin: linkedin/camus

@Override
public void init(Properties props, String topicName) {
 super.init(props, topicName);
 try {
  SchemaRegistry<Schema> registry =
    (SchemaRegistry<Schema>) Class.forName(
      props.getProperty(KafkaAvroMessageEncoder.KAFKA_MESSAGE_CODER_SCHEMA_REGISTRY_CLASS)).newInstance();
  log.info("Prop " + KafkaAvroMessageEncoder.KAFKA_MESSAGE_CODER_SCHEMA_REGISTRY_CLASS + " is: "
       + props.getProperty(KafkaAvroMessageEncoder.KAFKA_MESSAGE_CODER_SCHEMA_REGISTRY_CLASS));
  log.info("Underlying schema registry for topic: " + topicName + " is: " + registry);
  registry.init(props);
  this.registry = new CachedSchemaRegistry<Schema>(registry, props);
  this.latestSchema = registry.getLatestSchemaByTopic(topicName).getSchema();
 } catch (Exception e) {
  throw new MessageDecoderException(e);
 }
 decoderFactory = DecoderFactory.get();
}
origin: linkedin/camus

public void init(Properties props, String topicName) {
 super.init(props, topicName);
 this.props = props;
 this.topicName = topicName;
 
 this.schemaIDField = props.getProperty(CAMUS_SCHEMA_ID_FIELD, DEFAULT_SCHEMA_ID_FIELD);
 try {
  SchemaRegistry<Schema> registry = (SchemaRegistry<Schema>) Class.forName(
    props.getProperty(KafkaAvroMessageEncoder.KAFKA_MESSAGE_CODER_SCHEMA_REGISTRY_CLASS)).newInstance();
  log.info("Prop " + KafkaAvroMessageEncoder.KAFKA_MESSAGE_CODER_SCHEMA_REGISTRY_CLASS + " is: "
    + props.getProperty(KafkaAvroMessageEncoder.KAFKA_MESSAGE_CODER_SCHEMA_REGISTRY_CLASS));
  log.info("Underlying schema registry for topic: " + topicName + " is: " + registry);
  registry.init(props);
  
  this.registry = new CachedSchemaRegistry<Schema>(registry, props);
  this.latestSchema = ((Schema) registry.getLatestSchemaByTopic(topicName).getSchema());
 } catch (Exception e) {
  throw new MessageDecoderException(e);
 }
 
 this.decoderFactory = DecoderFactory.get();
}

origin: linkedin/camus

 @Override
 public CamusWrapper<Record> decode(Message message) {
  try {
   GenericDatumReader<Record> reader = new GenericDatumReader<Record>();

   Schema schema = super.registry.getLatestSchemaByTopic(super.topicName).getSchema();

   reader.setSchema(schema);

   return new CamusWrapper<Record>(reader.read(null, decoderFactory.jsonDecoder(schema, new String(message.getPayload(),
   //Message.payloadOffset(message.magic()),
     kafka.message.Message.MagicOffset(), message.getPayload().length - kafka.message.Message.MagicOffset()))));
  } catch (Exception e) {
   throw new RuntimeException(e);
  }
 }
}
origin: com.linkedin.camus/camus-api

public SchemaDetails<S> getLatestSchemaByTopic(String topicName) {
 SchemaDetails<S> schema = cachedLatest.get(topicName);
 if (schema == null) {
  schema = registry.getLatestSchemaByTopic(topicName);
  cachedLatest.putIfAbsent(topicName, schema);
 }
 return schema;
}
origin: confluentinc/camus

@Test
public void testSchemaRegistry() {
 try {
  registry.getLatestSchemaByTopic("test");
  fail("Should have failed with a SchemaNotFoundException.");
 } catch (SchemaNotFoundException e) {
 assertEquals(new SchemaDetails("test", id, getSchema1()), registry.getLatestSchemaByTopic("test"));
 assertEquals(new SchemaDetails("test", secondId, getSchema2()), registry.getLatestSchemaByTopic("test"));
  registry.getLatestSchemaByTopic("test-2");
  fail("Should have failed with a SchemaNotFoundException.");
 } catch (SchemaNotFoundException e) {
 assertEquals(new SchemaDetails("test", secondId, getSchema2()), registry.getLatestSchemaByTopic("test"));
com.linkedin.camus.schemaregistrySchemaRegistrygetLatestSchemaByTopic

Javadoc

Get the last schema that was written for a specific topic.

Popular methods of SchemaRegistry

  • getSchemaByID
    Get a schema for a given topic/id pair, regardless of whether the schema was the last one written fo
  • register
    Store a schema in the registry. If a schema already exists for this topic, the old schema will not b
  • init
    Initializer for SchemaRegistry;

Popular in Java

  • Running tasks concurrently on multiple threads
  • getSystemService (Context)
  • addToBackStack (FragmentTransaction)
  • setRequestProperty (URLConnection)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • MessageFormat (java.text)
    Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • Notification (javax.management)
  • Sublime Text for Python
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now