3 Replies Latest reply on Feb 6, 2012 12:53 AM by yanny wang

    What should my MessageHandler do to expect a redelivery of the same message with getDeliveryCount increased.

    yanny wang Newbie

      I'm using HornetQ 2.2.5. Final.

       

      My code will createa clientSession with (true, true, 1).

       

      I then create a ClientConsumer with consumer.setMessageHandlr(new MyHandler());

       

      in side MyHandler, what should I do in:

       

         public void onMessage(ClientMessage message) when something wrong happened and I want the same message to be redelivered with getDeliveryCount increased?

       

      should I:

       

      1.  throw exception in onMessage method?

      or

      2. message.acknowledge()?

      or

      3. message.acknowledge() and session.rollback()?

      o4

      4. session.rollback()?

      or

      5. session.commit() (without message.acknowledge?)

      or

      6. do nothing (no message acknowleddge, session has auto ack)

       

      in my config, I've set:

       

         <max-delivery-attempts>6</max-delivery-attempts>

         <redelivery-delay>1000</redelivery-delay>

        <persist-delivery-count-before-delivery>true</persist-delivery-count-before-delivery>

       

      Currently my choice is 6 yet I see redelivery every 5 minutes (instead of 1 second) with getDeliveryCount =1 all the time and the delviery attemps more than 6.

       

      I expect the message to be moved to DLQ but hasn't seen that happening yet.

       

      any suggestion?