@Test public void getJsonPayloadByByteArray() { ProducerMessage<String> proMsg = new ProducerMessage<String>(); String expected = "Hello Ctrip"; proMsg.setTopic("kafka.SimpleTextTopic"); proMsg.setBody(expected); proMsg.setPartitionKey("MyPartition"); proMsg.setKey("MyKey"); proMsg.setBornTime(System.currentTimeMillis()); DefaultMessageCodec codec = new DefaultMessageCodec(); byte[] proMsgByte = codec.encode(proMsg); byte[] payload = MessageCodecUtils.getPayload(proMsgByte); Object actual = JSON.parseObject(payload, String.class); assertEquals(expected, actual); }
public static ByteBuffer getPayload(ByteBuffer consumerMsg) { Pair<ByteBuffer, Date> pair = getPayloadAndBornTime(consumerMsg); return pair != null ? pair.getKey() : null; }
MessageCodecUtils { public static ByteBuffer getPayload(ByteBuffer consumerMsg) { Pair<ByteBuffer, Date> pair = getPayloadAndBornTime(consumerMsg); return pair != null ? pair.getKey() : null; } }
MessageCodecUtils { public static ByteBuffer getPayload(ByteBuffer consumerMsg) { Pair<ByteBuffer, Date> pair = getPayloadAndBornTime(consumerMsg); return pair != null ? pair.getKey() : null; }  }
MessageCodecUtils { public static ByteBuffer getPayload(ByteBuffer consumerMsg) { Pair<ByteBuffer, Date> pair = getPayloadAndBornTime(consumerMsg); return pair != null ? pair.getKey() : null; }  static ByteBuffer getPayload(ByteBuffer consumerMsg); static Pair<ByteBuffer, Date> getPayloadAndBornTime(ByteBuffer consumerMsg); static byte[] getPayload(byte[] consumerMsg); }
MessageCodecUtils { public static ByteBuffer getPayload(ByteBuffer consumerMsg) { Pair<ByteBuffer, Date> pair = getPayloadAndBornTime(consumerMsg); return pair != null ? pair.getKey() : null; }  static ByteBuffer getPayload(ByteBuffer consumerMsg); static Pair<ByteBuffer, Date> getPayloadAndBornTime(ByteBuffer consumerMsg); static byte[] getPayload(byte[] consumerMsg);  }