[ https://issues.apache.org/jira/browse/CAMEL-16762?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17370841#comment-17370841 ]
Freeman Yue Fang commented on CAMEL-16762: ------------------------------------------ PR is https://github.com/apache/camel/pull/5762 Also a testcase which test against a 188K file to expose this problem > Only the first payload chunk will be read when using jmsMessageType=Stream > -------------------------------------------------------------------------- > > Key: CAMEL-16762 > URL: https://issues.apache.org/jira/browse/CAMEL-16762 > Project: Camel > Issue Type: Bug > Components: came-jms > Reporter: Freeman Yue Fang > Assignee: Freeman Yue Fang > Priority: Major > > Only the first payload chunk(128K, the size of FileUtil.BUFFER_SIZE) will be > read when using jmsMessageType=Stream and if the payload is bigger than 128K, > the extra part will be discarded. > In the AMQ > ActiveMQStreamMessage[doc|https://activemq.apache.org/maven/apidocs/org/apache/activemq/command/ActiveMQStreamMessage.html], > we can see > {code} > A StreamMessage object is used to send a stream of primitive types in the > Java programming language. It is filled and read sequentially. > {code} > So if I read and understand it correctly, for each send on the producer side > we need a read on the consumer side. > For example, on the producer side > {code} > StreamMessage msg = session.createStreamMessage(); > msg.writeString("Thriller"); > msg.writeInt(1982); > msg.writeDouble(110.3); > {code} > and on the consumer side, we should have > {code} > // Read message > String title = msg.readString(); // must be read in the same order as written > int releaseYear = msg.readInt(); > double millionsSold = msg.readDouble(); > {code} > And here comes the tricky/vague part of this API, if on the producer side we > have > {code} > StreamMessage msg = session.createStreamMessage(); > msg.writeBytes(buffer); > msg.writeBytes(buffer); > msg.writeBytes(buffer); > {code} > Then on the consumer side we should have read the msg 3 times to ensure we've > consumed all 3 buffers. > Currently it's not this case in StreamMessageInputStream and hence if > jmsMessageType=Stream is used(or setStreamMessageTypeEnabled(true)) and the > payload is bigger than 128K, only the first 128K will be read at consumer side -- This message was sent by Atlassian Jira (v8.3.4#803005)