5 Replies Latest reply on May 15, 2008 2:47 AM by Andy Taylor

    Sending 512 kb of message Failing....

    John dasa Newbie

      Hi,
      I am trying to send 512 kb size of message...
      it is giving followin error message "The object is closed"

      This is way i am creating the message for testing
      StringBuilder message = new StringBuilder();
      for (int i = 0; i < 32768; i++) {
      message.append("aaaaaaaaaaaaaaaa");
      }
      Can any body Please tell me what is message size JBM supports?

      My requirement is i need to send 512 kb or may be some time 1 mb of
      data.

      Thanks,
      John

        • 1. Re: Sending 512 kb of message Failing....
          Andy Taylor Master

          looks like there is something wrong with your code. Please provide more info, the stacktrace and your example.

          • 2. Re: Sending 512 kb of message Failing....
            John dasa Newbie

            My code snippet i like this

            StringBuilder message = new StringBuilder();
            for (int i = 0; i < 32768; i++) {
            message.append("aaaaaaaaaaaaaaaa");
            }
            // 32768*16 == 512 kb

            TextMessage mesg = null;

            try {

            if (session != null) {
            mesg = session.createTextMessage(message);
            } else {
            throw new DataTransportException("Session object not found");
            }


            if (producer != null) {
            try {
            producer.send(mesg, DeliveryMode.PERSISTENT, 9, 0);
            } catch (Exception e) {
            System.out.println(e.getMessage());
            throw new DataTransportException("Not able to send message");
            }
            }

            System.out.println("Sending message :: " + message);

            } catch (Exception e) {
            System.out.println("Error In Sending Message :: " + message
            + " The error is :: " + e.getMessage());
            throw new DataTransportException("Message Not Send");
            }

            • 3. Re: Sending 512 kb of message Failing....
              Andy Taylor Master

              As far as i can see, that code snippet shouldn't compile, you're passing a StringBuilder as a parameter when creating the text message, i.e.

               mesg = session.createTextMessage(message);
              


              however, if i fix this:
              mesg = session.createTextMessage(message.toString());
              

              then i can run your code snippet, i would make sure you have the latest version of JBM and double check you're code is correct!

              • 4. Re: Sending 512 kb of message Failing....
                John dasa Newbie

                Sorry for late reply...
                I had some problem while sending .. but it seems i am able to send messages
                of size 256 kb also. but the surprising thing is while consuming some 10 000 messages the memory shoot up is more, and finally out of memory.

                is there any memory leak is happening from JBM side while consuming ??

                if try to consume 512 kb from persistance data base , consuming only the
                memory shoot up very much . dont know what to do ??

                and also if i close consumer five , six time, it simply stuck while getting the connection?

                --Thanks

                • 5. Re: Sending 512 kb of message Failing....
                  Andy Taylor Master

                  post your consumer code so i can see what you are doing!

                  Also make sure you are using the latest versions of JBM and remoting