2 Replies Latest reply on Sep 17, 2013 1:41 PM by Shannon Hardt

    Acknowledging JMS messages using the Core API?

    Shannon Hardt Newbie



      I have a JMS consumer reading messages from a queue using client acknowledge mode. However, I would like more granular control over message acknowledgement. Is it possible to use the Core API to individually acknowledge JMS messages? Or is that a recipe for disaster? Should I just bite the bullet and rewrite the JMS producer and consumer using the Core API?


      My attempts so far have proven problematic. In my JMS consumer, I was successful in reading the message from the queue, casting it to HornetQMessage, and calling getCoreMessage().individualAcknowledge(). This sent the ack to the server, but the server wrote the following complaint to the log:


      java.lang.IllegalStateException: Cannot find ref to ack ###


      Furthermore, the messages remain in the queue. However, it struck me as odd that after consuming the message from the queue, the contents of the messages are empty. Everything works as expected if I use the acknowledge() method on the JMS message interface.


      I am using HornetQ 2.3.1.Final.


      Any advice would be appreciated!