use of com.hortonworks.registries.schemaregistry.serdes.SerDesProtocolHandler in project registry by hortonworks.
the class AbstractAvroSnapshotDeserializer method deserializePayloadForProtocol.
protected Object deserializePayloadForProtocol(byte protocolId, InputStream payloadInputStream, Schema writerSchema, Schema readerSchema) throws SerDesException {
Map<String, Object> props = new HashMap<>();
props.put(SPECIFIC_AVRO_READER, useSpecificAvroReader);
props.put(WRITER_SCHEMA, writerSchema);
props.put(READER_SCHEMA, readerSchema);
SerDesProtocolHandler serDesProtocolHandler = SerDesProtocolHandlerRegistry.get().getSerDesProtocolHandler(protocolId);
return serDesProtocolHandler.handlePayloadDeserialization(payloadInputStream, props);
}
use of com.hortonworks.registries.schemaregistry.serdes.SerDesProtocolHandler in project registry by hortonworks.
the class AbstractAvroSnapshotSerializer method doInit.
@Override
public void doInit(Map<String, ?> config) {
Number number = (Number) ((Map<String, Object>) config).getOrDefault(SERDES_PROTOCOL_VERSION, SerDesProtocolHandlerRegistry.CURRENT_PROTOCOL);
validateSerdesProtocolVersion(number);
Byte protocolVersion = number.byteValue();
SerDesProtocolHandler serDesProtocolHandler = SerDesProtocolHandlerRegistry.get().getSerDesProtocolHandler(protocolVersion);
if (serDesProtocolHandler == null) {
throw new AvroException("SerDesProtocolHandler with protocol version " + protocolVersion + " does not exist");
}
this.serDesProtocolHandler = serDesProtocolHandler;
}
Aggregations