MessagePackRecordFormatter extends AbstractRecordFormatter { @Override public byte[] format(String tag, Object timestamp, Map<String, Object> data) { try { MapRecordAccessor recordAccessor = new MapRecordAccessor(data); recordAccessor.setTimestamp(getEpoch(timestamp)); return recordAccessor.toMessagePack(objectMapperForMessagePack); } catch (Throwable e) { LOG.error(String.format( "Failed to format a Map record: cause=%s, tag=%s, timestamp=%s, recordCount=%d", e.getMessage(), tag, timestamp, data.size())); throw e; } } MessagePackRecordFormatter();  MessagePackRecordFormatter(Config config); @Override byte[] format(String tag, Object timestamp, Map<String, Object> data); @Override byte[] formatFromMessagePack(String tag, Object timestamp, byte[] mapValue, int offset, int len); @Override byte[] formatFromMessagePack(String tag, Object timestamp, ByteBuffer mapValue); @Override String formatName();  }
@Test void format() throws IOException { long now = System.currentTimeMillis() / 1000; assertRecord0(recordFormatter.format(TAG, now, RECORD_0), now); assertRecord1(recordFormatter.format(TAG, now, RECORD_1), FUTURE_EPOCH); assertRecord2(recordFormatter.format(TAG, now, RECORD_2), now); }