5 Replies Latest reply on Jan 18, 2010 8:04 AM by Tim Fox

    send-acknowledgements example

    Pieter Martin Novice

      Hi,

       

      I am trying to get the send-acknowledgements feature of hornetq to work in my application.

       

      However when I run the example I do not see the acknowledgements being received in the console output.

       

      public void sendAcknowledged(final Message message)

      {

           System.out.println("Received send acknowledgement for message " + count++);

      }

       

      Should I be seeing them in the example app output?

       

      I am also not receiving the acknowledgements in my own application.

      In my producer I call Thread.sleep(100000) as I think perhaps the producer exists before the server sends the acknowledgements.

       

      Thanks

      Pieter

       

      BTW, I have tried the  send-acknowledgement example on both 2.0.0.CR3 and 2.0.0.GA.

        • 1. Re: send-acknowledgements example
          Tim Fox Master

          The example is actually broken since it doesn't set the confirmation window size on the connection factory.

           

          What did you set it to in your application? (Did you read the chapter on send acknowledgements?)

          1 of 1 people found this helpful
          • 2. Re: send-acknowledgements example
            Pieter Martin Novice

            Hi,

             

            I read the chapter, but not well enough I'm afraid. After the example also did not quite work as expected I posted.

             

            I added the confirmation window size now and am getting the acknowledgement, thanks.

             

            I see the acknowledgement comes before the onMessage message has completed. As per the doc...

             

            "The consumer then processes the message and when it is done, it acknowledges the message." Does it work like this with the send-acknowledgements also?

             

             

            Thanks

            Pieter

            • 3. Re: send-acknowledgements example
              Tim Fox Master

              Sorry, I don't understand what you meant by:

               

              "

              I see the acknowledgement comes before the onMessage message has completed. As per the doc...

               

              "The consumer then processes the message and when it is done, it acknowledges the message." Does it work like this with the send-acknowledgements also?"

              • 4. Re: send-acknowledgements example
                Pieter Martin Novice

                Hi,

                 

                I am getting the acknowledgements on the producer for the sent messages long before the onMessage() method of the MessageListener has completed. I was expecting an acknowledgement for a message to be sent to the producer's SendAcknowledgementHandler only once the onMessage method has completed. i.e. once the consumer has finished consuming a message.

                 

                So at the moment I am sending 5 messages. Each message's corresponding onMessage(Message arg0) takes +/- 5 minutes to complete. Yet on the produces the acknowledgements are almost immediately there, within 2 seconds or so.

                 

                My consumer is a MDB deployed in jboss at the moment.

                 

                The producer is a standalone JMS producer.

                 

                Thanks

                Pieter

                • 5. Re: send-acknowledgements example
                  Tim Fox Master

                  Pieter-

                   

                  You are misunderstanding what send acknowledgements are.

                   

                  Send acknowledgements are not at all related to delivery of messages to consumers.

                   

                  A send acknowledgement is sent from the server, when the message has been successfully *sent* to the server.

                   

                  This has got nothing to do with message delivery!

                   

                  I suggest reading the chapter again.