Codota Logo
SchemaRegistry.getSchemaByID
Code IndexAdd Codota 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)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
BufferedReader b =
  • Codota IconInputStream in;new BufferedReader(new InputStreamReader(in))
  • Codota IconReader in;new BufferedReader(in)
  • Codota IconFile file;new BufferedReader(new FileReader(file))
  • Smart code suggestions by Codota
}
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

  • Running tasks concurrently on multiple threads
  • requestLocationUpdates (LocationManager)
  • getSystemService (Context)
  • startActivity (Activity)
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • LinkedHashMap (java.util)
    Hash table and linked list implementation of the Map interface, with predictable iteration order. Th
  • TreeMap (java.util)
    A Red-Black tree based NavigableMap implementation. The map is sorted according to the Comparable of
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now