@Override public String register(String topic, S schema) { long id = ids.incrementAndGet(); MemorySchemaRegistryTuple tuple = new MemorySchemaRegistryTuple(topic, id); schemasById.put(tuple, schema); latest.put(topic, tuple); return Long.toString(id); }
@Override public String register(String topic, S schema) { long id = ids.incrementAndGet(); MemorySchemaRegistryTuple tuple = new MemorySchemaRegistryTuple(topic, id); schemasById.put(tuple, schema); latest.put(topic, tuple); return Long.toString(id); }
@Override public S getSchemaByID(String topicName, String idStr) { try { S schema = schemasById.get(new MemorySchemaRegistryTuple(topicName, Long.parseLong(idStr))); if (schema == null) { throw new SchemaNotFoundException(); } return schema; } catch (NumberFormatException e) { throw new SchemaNotFoundException("Supplied a non-long id string.", e); } }
@Override public S getSchemaByID(String topicName, String idStr) { try { S schema = schemasById.get(new MemorySchemaRegistryTuple(topicName, Long.parseLong(idStr))); if (schema == null) { throw new SchemaNotFoundException(); } return schema; } catch (NumberFormatException e) { throw new SchemaNotFoundException("Supplied a non-long id string.", e); } }