Skip to content

Latest commit

 

History

History
22 lines (18 loc) · 689 Bytes

README.md

File metadata and controls

22 lines (18 loc) · 689 Bytes

messagepack

Maps streams of objects to messagepack arrays without allocation. Faster and lighter-weight than msgpack-java.

var buffer = ByteBuffer.allocate(BUFFER_SIZE);
var serialiser = new Packer(b -> send(b), buffer);
for (MyMetric myMetric : myMetrics) {
  serialiser.serialise(myMetric, (MyMetric metric, Writable writable) -> {
     writable.writeString("id");
     writable.writeLong(metric.getId());
     writable.writeString("name");
     writable.writeString(metric.getName());
     writable.writeString("value");
     writable.writeDouble(metric.getValue());
     writable.writeString("tags");
     writable.writeMap(metric.getTags());
});
serialiser.flush();