4 Replies Latest reply on May 7, 2010 6:11 PM by clebert.suconic

    Streaming vs. large messages

    bill.burke

      The user documentation that discusses streaming and large messages is a little unclear.

       

      I want create a message directly from an HTTP InputStream.  I have a couple of questions if I use the client API - ClientMessage.setBodyInputStream(is)

       

      1) If the message is non-durable, will the input stream be consumed at send() within the same thread?  Obviously, the servlet container will close the input stream.

      2) If the message is non-durable, will the input stream still be stored in a file?  Or is that controlled by the size of the message body?  For performance reasons, I don't want small messages persisted.

       

      Thanks

        • 1. Re: Streaming vs. large messages
          clebert.suconic

          Streaming and large messages are basically the same thing. Any streaming message is sent as a large message.

           

           

          A message with a regular body is considered a large message only depending on its size.

           

           

          When you use streaming, the server will send the message in chunks... and a file will be created at the server. (LargeMessage directory).

           

          The only difference between durable and non-durable large messages is the extension they take. If you restart the server, all the large messages are removed (as there is no reference to them on the journal).

           

          When a durable large message is sent, we also add a reference to the journal (with a reference to the external file).

          • 2. Re: Streaming vs. large messages
            bill.burke

            Thanks Clebert.

             

            I guess I'm better off reading the HTTP InputStream into a byte array then.

            • 3. Re: Streaming vs. large messages
              clebert.suconic

                I guess you would be fine on an InputStream.. unless you don't want a large message

              • 4. Re: Streaming vs. large messages
                clebert.suconic

                I guess I know what you mean... you have HttpInputStream for stuff that's not going to be large at all?

                 

                I guess then you should use a byte array on small messages and streaming only on the messages that are supposed to be large. you probably have the header with the size the message somewhere.