Package org.apache.avro.repo

Examples of org.apache.avro.repo.Subject


       client = new RESTRepositoryClient(props.getProperty(ETL_SCHEMA_REGISTRY_URL));
  }

  @Override
  public String register(String topic, Schema schema) {
    Subject subject = client.lookup(topic);

    if (subject == null) {
      subject = client.register(topic, "org.apache.avro.repo.Validator");
    }

    try {
      return subject.register(schema.toString()).getId();
    } catch (SchemaValidationException e) {
      throw new SchemaRegistryException(e);
    }
  }
View Full Code Here


    }
  }

  @Override
  public Schema getSchemaByID(String topic, String id) {
    Subject subject = client.lookup(topic);

    if (subject == null) {
      throw new SchemaNotFoundException("Schema not found for " + topic);
    }

    SchemaEntry entry = subject.lookupById(id);

    if (entry == null)
      throw new SchemaNotFoundException("Schema not found for " + topic
          + " " + id);
View Full Code Here

    return Schema.parse(entry.getSchema());
  }

  @Override
  public SchemaDetails<Schema> getLatestSchemaByTopic(String topicName) {
    Subject subject = client.lookup(topicName);

    if (subject == null) {
      throw new SchemaNotFoundException("Schema not found for "
          + topicName);
    }

    SchemaEntry entry = subject.latest();

    if (entry == null)
      throw new SchemaNotFoundException("Schema not found for "
          + topicName);
View Full Code Here

TOP

Related Classes of org.apache.avro.repo.Subject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.