Forum Stats

  • 3,769,482 Users
  • 2,252,969 Discussions
  • 7,875,047 Comments

Discussions

About onMessage

885259
885259 Member Posts: 2
edited Aug 30, 2011 5:36AM in Java Message Service (JMS)
Hello,

I would like to know what happen if my application fail (lets suppose the computer break) before the onMessage() return (on a class that implement javax.jms.MessageListener). Suppose the acknowldge used is AUTO_ACKNOWLEDGE. What happen? The JMS Server was acknowledge or not?

Thank you for the attention.

Best Answer

  • 883902
    883902 Member Posts: 4
    Accepted Answer
    If you are using "AUTO_ACKNOWLEDGE" in a non-transacted session, and application fail before control successfully returns from onMessage() method, JMS server will not be acknowledged.

    Go through this article, http://www.javaworld.com/javaworld/jw-02-2002/jw-0315-jms.html?page=1 , to make your understanding a bit more sound.

    I hope this helps.

Answers

  • 883902
    883902 Member Posts: 4
    Accepted Answer
    If you are using "AUTO_ACKNOWLEDGE" in a non-transacted session, and application fail before control successfully returns from onMessage() method, JMS server will not be acknowledged.

    Go through this article, http://www.javaworld.com/javaworld/jw-02-2002/jw-0315-jms.html?page=1 , to make your understanding a bit more sound.

    I hope this helps.
  • 885259
    885259 Member Posts: 2
    Yeah. Helps a lot. Thank you very much.
  • 882256 wrote:
    Hello,

    I would like to know what happen if my application fail (lets suppose the computer break) before the onMessage() return (on a class that implement javax.jms.MessageListener). Suppose the acknowldge used is AUTO_ACKNOWLEDGE. What happen? The JMS Server was acknowledge or not?
    If onMessage() does not return successfully then the message will not be auto-acknowledged.

    See the javadoc for Session.AUTO_ACKNOWLEDGE:
    http://download.oracle.com/javaee/6/api/javax/jms/Session.html#AUTO_ACKNOWLEDGE
    this states that "With this acknowledgment mode, the session automatically acknowledges a client's receipt of a message... when the message listener the session has called to process the message successfully returns. "

    Nigel
This discussion has been closed.