if (ba.get(ActiveMQMessage.PAYLOAD_INDEX)) {
int payloadLength = dataIn.readInt();
if (payloadLength >= 0) {
if (dataIn instanceof WireByteArrayInputStream){
WireByteArrayInputStream wireIn = (WireByteArrayInputStream)dataIn;
msg.setBodyAsBytes(wireIn.getRawData(), wireIn.position(), payloadLength);
}else {
byte[] payload = new byte[payloadLength];
dataIn.readFully(payload);
msg.setBodyAsBytes(payload,0,payload.length);
}