@Test public void testAvroDecoderCompatible() { String topic = "testAvro"; Object avroRecordV1 = createAvroRecordVersion1(); byte[] payloadV1 = avroSerializer.serialize(topic, avroRecordV1); Object avroRecordV2 = createAvroRecordVersion2(); byte[] payloadV2 = avroSerializer.serialize(topic, avroRecordV2); AvroMessageDecoder decoder = createAvroDecoder(topic, true, schemaRegistry); try { decoder.decode(payloadV1).getRecord(); } catch (MessageDecoderException e) { fail("Backward compatible schema should be able to decode Avro records with old schema"); } Object recordV2 = decoder.decode(payloadV2).getRecord(); assertEquals(avroRecordV2, recordV2); }
public CamusWrapper<Record> decode(byte[] payload) { Object object = deserialize(payload); if (object instanceof Record) { return new CamusAvroWrapper((Record) object); } else { throw new MessageDecoderException("Camus does not support Avro primitive types!"); } }
AvroMessageDecoder extends MessageDecoder<byte[], Record> { public CamusWrapper<Record> decode(byte[] payload) { Object object = deserialize(payload); if (object instanceof Record) { return new CamusAvroWrapper((Record) object); } else { throw new MessageDecoderException("Camus does not support Avro primitive types!"); } } }
AvroMessageDecoder extends MessageDecoder<byte[], Record> { public CamusWrapper<Record> decode(byte[] payload) { Object object = deserialize(payload); if (object instanceof Record) { return new CamusAvroWrapper((Record) object); } else { throw new MessageDecoderException("Camus does not support Avro primitive types!"); } } AvroMessageDecoder(SchemaRegistryClient schemaRegistry);  AvroMessageDecoder(); }
AvroMessageDecoder extends MessageDecoder<byte[], Record> { public CamusWrapper<Record> decode(byte[] payload) { Object object = deserialize(payload); if (object instanceof Record) { return new CamusAvroWrapper((Record) object); } else { throw new MessageDecoderException("Camus does not support Avro primitive types!"); } } AvroMessageDecoder(SchemaRegistryClient schemaRegistry);  AvroMessageDecoder(); @Override void init(Properties props, String topicName); CamusWrapper<Record> decode(byte[] payload); }
AvroMessageDecoder extends MessageDecoder<byte[], Record> { public CamusWrapper<Record> decode(byte[] payload) { Object object = deserialize(payload); if (object instanceof Record) { return new CamusAvroWrapper((Record) object); } else { throw new MessageDecoderException("Camus does not support Avro primitive types!"); } } AvroMessageDecoder(SchemaRegistryClient schemaRegistry);  AvroMessageDecoder(); @Override void init(Properties props, String topicName); CamusWrapper<Record> decode(byte[] payload);  }