ffang commented on a change in pull request #5762:
URL: https://github.com/apache/camel/pull/5762#discussion_r660245109



##########
File path: 
components/camel-jms/src/main/java/org/apache/camel/component/jms/StreamMessageInputStream.java
##########
@@ -48,6 +48,11 @@ public int read() throws IOException {
     public int read(byte[] array) throws IOException {
         try {
             int num = message.readBytes(array);
+            if (num < 0) {
+                //the first 128K(FileUtil.BUFFER_SIZE/128K is used when 
sending JMS StreamMessage) 
+                //buffer reached, give a chance to see if there is the next 
128K buffer
+                num = message.readBytes(array);
+            }

Review comment:
       Hi @zhfeng,
   
   Thanks for your feedback!
   
   The comment may be misleading, but the logic here actually will read all 
n*128k chunk until the end of the JMS StreamMessage.  The point is that when 
finishing reading 1 chunk, give chance to read the next chunk, and don't return 
a negative num, and all caller code which call into 
StreamMessageInputStream(which is an InputStream) read(byte[] array) will keep 
the read operation going.
   
   Cheers
   Freeman




-- 
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.

To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org

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


Reply via email to