use of org.apache.activemq.artemis.protocol.amqp.util.NettyWritable in project activemq-artemis by apache.
the class AMQPMessage method encodeProtonMessage.
private void encodeProtonMessage() {
int estimated = Math.max(1500, data != null ? data.capacity() + 1000 : 0);
ByteBuf buffer = PooledByteBufAllocator.DEFAULT.heapBuffer(estimated);
try {
getProtonMessage().encode(new NettyWritable(buffer));
byte[] bytes = new byte[buffer.writerIndex()];
buffer.readBytes(bytes);
this.data = Unpooled.wrappedBuffer(bytes);
} finally {
buffer.release();
}
}
Aggregations