byte[] wrapContent(byte[] message, String id, long timestamp, Schema schema, Map<String, String> externalMetadata) { try { GenericRecord genericRecord = bytesToRecord(message, schema); genericRecord.put(METADATA_MARKER, metadataMap(id, timestamp, externalMetadata)); return recordToBytes(genericRecord, schema); } catch (Exception exception) { throw new WrappingException("Could not wrap avro message", exception); } }
private byte[] wrapContent(byte[] message, Schema schema, Map<Utf8, Utf8> metadata) throws Exception { GenericRecord genericRecord = bytesToRecord(message, schema); genericRecord.put(METADATA_MARKER, metadata); return recordToBytes(genericRecord, schema); }