Github user clebertsuconic commented on a diff in the pull request:
https://github.com/apache/activemq-artemis/pull/1970#discussion_r176528336
--- Diff:
artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/CoreMessage.java
---
@@ -213,6 +218,63 @@ public ActiveMQBuffer getReadOnlyBodyBuffer() {
return new ChannelBufferWrapper(buffer.slice(BODY_OFFSET,
endOfBodyPosition - BUFFER_HEADER_SPACE).setIndex(0, endOfBodyPosition -
BUFFER_HEADER_SPACE).asReadOnly());
}
+ /**
+ * This will return the proper buffer to represent the data of the
Message. If compressed it will decompress.
+ * If large, it will read from the file or streaming.
+ * @return
+ * @throws ActiveMQException
+ */
+ @Override
+ public ActiveMQBuffer getDataBuffer() {
+
+ ActiveMQBuffer buffer;
+
+ try {
+ if (isLargeMessage()) {
+ LargeBodyEncoder encoder = getBodyEncoder();
+ encoder.open();
+ int bodySize = (int) encoder.getLargeBodySize();
+
+ buffer = new
ChannelBufferWrapper(UnpooledByteBufAllocator.DEFAULT.heapBuffer(bodySize));
+
+ encoder.encode(buffer, bodySize);
+ encoder.close();
+ } else {
+ buffer = getReadOnlyBodyBuffer();
+ }
+
+ if
(Boolean.TRUE.equals(getBooleanProperty(Message.HDR_LARGE_COMPRESSED))) {
+ buffer = inflate(buffer);
+ }
+ } catch (Exception e) {
+ ActiveMQIOErrorException e2 = new ActiveMQIOErrorException();
--- End diff --
ok.. fixed.. I had a mistake on this exception anyways.. I also broke the
method you mentioned.. good catch
---