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

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

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

origin: linkedin/camus

 public MessageDecoderHelper invoke(String id) {
  this.schema = (this.registry.getSchemaByID(this.topicName, id));
  if (this.schema == null)
   throw new IllegalStateException("Unknown schema id: " + id);
  this.targetSchema = JSONToAvroMessageDecoder.this.latestSchema;
  return this;
 }
}
origin: linkedin/camus

 public MessageDecoderHelper invoke() {
  buffer = getByteBuffer(payload);
  String id = Integer.toString(buffer.getInt());
  schema = registry.getSchemaByID(topicName, id);
  if (schema == null)
   throw new IllegalStateException("Unknown schema id: " + id);
  start = buffer.position() + buffer.arrayOffset();
  length = buffer.limit() - 5;
  // try to get a target schema, if any
  targetSchema = latestSchema;
  return this;
 }
}
origin: linkedin/camus

private synchronized S fetchFromSchemaRegistry(String topic, String id) {
 try {
  S schema = registry.getSchemaByID(topic, id);
  return schema;
 } catch (SchemaNotFoundException e) {
  addFetchToFailureHistory(id);
  throw e;
 }
}
origin: linkedin/camus

 @Test
 public void testMinInterval() throws InterruptedException {
  EasyMock.expect(registry.getSchemaByID(EasyMock.anyString(), EasyMock.anyString())).andThrow(
    new SchemaNotFoundException());
  EasyMock.expectLastCall().times(4);
  EasyMock.replay(registry);
  props.setProperty(GET_SCHEMA_BY_ID_MAX_RETIRES, String.valueOf(Integer.MAX_VALUE));
  props.setProperty(GET_SCHEMA_BY_ID_MIN_INTERVAL_SECONDS, "2");
  cachedRegistry = new CachedSchemaRegistry<Schema>(registry, props);
  for (int i = 0; i < 2; i++) {
   for (int j = 0; j < 5; j++) {
    try {
     cachedRegistry.getSchemaByID("dummyTopic", "dummyID");
    } catch (SchemaNotFoundException e) {
    }
    try {
     cachedRegistry.getSchemaByID("dummyTopic", "dummyID2");
    } catch (SchemaNotFoundException e) {
    }
   }
   Thread.sleep(2500);
  }
  EasyMock.verify(registry);
 }
}
origin: linkedin/camus

@Test
public void testMaxRetries() {
 EasyMock.expect(registry.getSchemaByID(EasyMock.anyString(), EasyMock.anyString())).andThrow(
   new SchemaNotFoundException());
 EasyMock.expectLastCall().times(20);
 EasyMock.replay(registry);
 props.setProperty(GET_SCHEMA_BY_ID_MAX_RETIRES, "10");
 props.setProperty(GET_SCHEMA_BY_ID_MIN_INTERVAL_SECONDS, "0");
 cachedRegistry = new CachedSchemaRegistry<Schema>(registry, props);
 for (int i = 0; i < 100; i++) {
  try {
   cachedRegistry.getSchemaByID("dummyTopic", "dummyID");
  } catch (SchemaNotFoundException e) {
  }
  try {
   cachedRegistry.getSchemaByID("dummyTopic", "dummyID2");
  } catch (SchemaNotFoundException e) {
  }
 }
 EasyMock.verify(registry);
}
origin: com.linkedin.camus/camus-api

private synchronized S fetchFromSchemaRegistry(String topic, String id) {
 try {
  S schema = registry.getSchemaByID(topic, id);
  return schema;
 } catch (SchemaNotFoundException e) {
  addFetchToFailureHistory(id);
  throw e;
 }
}
origin: confluentinc/camus

@Test
public void testWithSchema() {
  SchemaRegistry schemaRegistry = createMock(SchemaRegistry.class);
  Schema schema = SchemaBuilder.record("testRecord").namespace("my.name.space")
      .fields().name("field").type().stringType().noDefault().endRecord();
  expect(schemaRegistry.getSchemaByID("myTopic", "1751217253")).andReturn(schema);
  replay(schemaRegistry);
  KafkaAvroMessageDecoder kafkaAvroMessageDecoder = new KafkaAvroMessageDecoder();
  final byte[] bytes = "whatever".getBytes();
  bytes[0] = 0x0; // Magic byte
  KafkaAvroMessageDecoder.MessageDecoderHelper messageDecoderHelper = kafkaAvroMessageDecoder.new MessageDecoderHelper(schemaRegistry, "myTopic", bytes);
  KafkaAvroMessageDecoder.MessageDecoderHelper actualResult = messageDecoderHelper.invoke();
  verify(schemaRegistry);
  assertEquals("my.name.space", actualResult.getSchema().getNamespace());
  assertEquals(5, actualResult.getStart());
  assertEquals(bytes, actualResult.getBuffer().array());
  assertEquals(3, actualResult.getLength());
}
origin: confluentinc/camus

 registry.getSchemaByID("test", "abc");
 fail("Should have failed with a SchemaNotFoundException.");
} catch (SchemaNotFoundException e) {
 registry.getSchemaByID("test", "abc");
 fail("Should have failed with a SchemaNotFoundException.");
} catch (SchemaNotFoundException e) {
assertEquals(getSchema1(), registry.getSchemaByID("test", id));
assertEquals(new SchemaDetails("test", id, getSchema1()), registry.getLatestSchemaByTopic("test"));
assertEquals(getSchema1(), registry.getSchemaByID("test", id));
assertEquals(getSchema2(), registry.getSchemaByID("test", secondId));
assertEquals(new SchemaDetails("test", secondId, getSchema2()), registry.getLatestSchemaByTopic("test"));
 registry.getSchemaByID("test-2", "");
 fail("Should have failed with a SchemaNotFoundException.");
} catch (SchemaNotFoundException e) {
assertEquals(getSchema1(), registry.getSchemaByID("test", id));
assertEquals(getSchema2(), registry.getSchemaByID("test", secondId));
assertEquals(new SchemaDetails("test", secondId, getSchema2()), registry.getLatestSchemaByTopic("test"));
com.linkedin.camus.schemaregistrySchemaRegistrygetSchemaByID

Javadoc

Get a schema for a given topic/id pair, regardless of whether the schema was the last one written for this topic.

Popular methods of SchemaRegistry

  • getLatestSchemaByTopic
    Get the last schema that was written for a specific topic.
  • 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

  • Parsing JSON documents to java classes using gson
  • addToBackStack (FragmentTransaction)
  • compareTo (BigDecimal)
  • requestLocationUpdates (LocationManager)
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • KeyStore (java.security)
    KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • Top 15 Vim Plugins
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