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?


      2. message.acknowledge()?


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


      4. session.rollback()?


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


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


      in my config, I've set:






      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?