You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@activemq.apache.org by GitBox <gi...@apache.org> on 2020/12/07 23:06:12 UTC

[GitHub] [activemq-artemis] tabish121 commented on a change in pull request #3373: ARTEMIS-3023 Avoid opening AMQP Large Message for final parsing

tabish121 commented on a change in pull request #3373:
URL: https://github.com/apache/activemq-artemis/pull/3373#discussion_r537900818



##########
File path: artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPLargeMessage.java
##########
@@ -362,6 +348,62 @@ public void addBytes(ReadableBuffer data) throws Exception {
       }
    }
 
+   protected void parseLargeMessage(ActiveMQBuffer data, boolean initialHeader) {
+      MessageDataScanningStatus status = getDataScanningStatus();
+      if (status == MessageDataScanningStatus.NOT_SCANNED) {
+         ByteBuf buffer = data.byteBuf().duplicate();
+         if (parsingBuffer == null) {
+            parsingBuffer = new CompositeReadableBuffer();
+         }
+
+         byte[] parsingData = new byte[buffer.readableBytes()];
+         buffer.readBytes(parsingData);
+         parsingBuffer.append(parsingData);
+         if (!initialHeader) {
+            genericPargeLargeMessage();
+         }
+      }
+   }
+
+   protected void parseLargeMessage(byte[] data, boolean initialHeader) {
+      MessageDataScanningStatus status = getDataScanningStatus();
+      if (status == MessageDataScanningStatus.NOT_SCANNED) {
+         byte[] copy = new byte[data.length];
+         System.arraycopy(data, 0, copy, 0, data.length);
+         if (parsingBuffer == null) {
+            parsingBuffer = new CompositeReadableBuffer();
+         }
+         parsingBuffer.append(copy);
+         if (!initialHeader) {
+            genericPargeLargeMessage();
+         }
+      }
+   }
+
+   private void genericPargeLargeMessage() {

Review comment:
       Thinking there might be a spelling error here




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org