6 Replies Latest reply on Aug 28, 2010 10:16 PM by steven.landers

    StreamMessage seems truncated

    steven.landers

      Key Info:

      - We're in the process of going from JBossMQ to HornetQ.

      - I haven't yet installed (nor have had approved - its out of my control) the absolute latest version or HornetQ yet, but I have the previous (2.1.1)

      - Running HornetQ on top of JBoss5

       

      My Issue:

      1) I put 4k of XML into a StreamMessage

      2) It is placed in a HornetQ

      3) I consume the message

      4) The StreamMessage seems to only contain up to the opening Tag  (first greater than sign) - throwing an EOF afterwards.

       

      When I do the same, except with a JBossMQ, this does not occur - and the whole message can be parsed as XML via Sax.

       

      Does anyone have any thoughts regarding what might be causing this?  Perhaps I need to configure something size-oriented on the queue?  I thought it was newlines at first, so I removed those, but to no avail.  I'm particularly interested in why it ends at the first greater than sign - without fail, regardless of the size of the tag.

       

      Thanks for your time!

      Steven

        • 1. Re: StreamMessage seems truncated
          clebert.suconic

          JBoss MQ doesn't support Streaming (as far as I know).. You can just have large bodies.

           

           

          How you're sending your message?

           

           

           

          You should probably provide some code here on your post.

           

          If you think you're hitting a bug, you should definitely share a testcase. Most likely you're doing something wrong at your stream code.

          • 2. Re: StreamMessage seems truncated
            steven.landers

            Thanks for the response!

             

            When using JBossMQ, the object becomes a SpyStreamMessage

            http://docs.jboss.org/jbossas/javadoc/4.0.4/messaging/org/jboss/mq/SpyStreamMessage.html

             

            Currently we're doing a store-and-forward from a boxes's local queue to a shared queue.

             

            1) Message goes into local queue (JBossMQ...we will later use HornetQ but not able to yet)

            2) SpyStreamMessage is consumed by store-and-forward spring Pojo  (stream contains 100% of everything at this point)

            3) Using Spring's JMSTemplate to forward to HornetQ

             

             
            public void send(final Message message) throws Exception{
                 
                 template.send(remoteDestination, new MessageCreator(){
                      @Override
                      public Message createMessage(Session sess) throws JMSException {
                           return message;
                      }  
                 });
            }
            
            

             

            4) HornetQStreamMessage is consumed, but now it only contains up to the first greater-than-sign.  If I use a JBossMQ instead...it contains the whole message.

             

            Maybe SpyStreamMessage is fundamentally different than later implementations of StreamMessage?

             

            Thanks for your consideration and time,

            Steven

            • 3. Re: StreamMessage seems truncated
              clebert.suconic

              Of course, You can't just send a SpyStreamMessage and assume it will be received.

               

               

              You have to use the proper API from HornetQ.

               

               

              There's no common JMS API for LargeMessage. For HornetQ you should create a regular message and set a property, as explained on the user's manual:

               

              http://hornetq.sourceforge.net/docs/hornetq-2.1.2.Final/user-manual/en/html/large-messages.html#large-messages.streaming.over.jms

               

               

              Look at the large messages example also

              • 4. Re: StreamMessage seems truncated
                timfox

                Clebert, a StreamMessage is a standard JMS message type, you're confusing it with large messages.

                • 5. Re: StreamMessage seems truncated
                  clebert.suconic

                  Duh!... Yes.. I was confusing with Streaming on large message.. thanks.

                   

                   

                  So, that means we're not accepting well a JBoss MQ JMS StreamMessage.

                  • 6. Re: StreamMessage seems truncated
                    steven.landers

                    For now we're able to workaround by converting the SpyStreamMessage to a HornetQTextMessage prior to forwarding it.  Eventually, we aim to replace the queuing on the JBossMQ servers with HornetQ as well - but we're having to take this one-step-at-a-time. 

                     

                    I can also get HornetQStreamMessage to work if I read the bytes off the SpyStreamMessage then use writeString to put them onto the HornetQStreamMessage - but given our limited 4k size, this seemed similar enough to the TextMessage approach.  (I think the issue has to do with JBossMQ differences for readBytes/writeBytes)

                     

                    Thanks for your help guys - I think I'm good on this problem for now - but let me know if you have any questions that can help.

                     

                    -Steven