I have a very simple question: when we speak of acknowledgement in JMS what does it actually mean?
Is it acknowledgement from the Message Receiver to the message producer? or is it acknowledgement from the message listener to the JMS container?
Thank you for the reply.
When we are producing a message,we create a queue session with an acknowledgement mode parameter. In this case is the acknowledgement from the container to the message producer?
Also if possible, can you give me a scenario when a message will not be registered with a queue . I want to test what happens when no acknowledgement is received. If it is not asking for much.
Message Acknowledgement has nothing to do with the producer. The Queue Session has Acknowledgement mode as one of it's parameters because you can create consumers/producers alike from a session and the Ack Mode affects only the consumer.
message will not be registered with a queue
Not sure what exactly you mean by that. Are you saying when will a message be *not* sent to the queue, after a producer calls send(..)? The API has the following Exceptions for the send() method:
JMSException - if the JMS provider fails to send the message due to some internal error. Internal error is anything related to your network, port accessibility, provider not running scenarios..
MessageFormatException - if an invalid message is specified.
InvalidDestinationException - if a client uses this method with an invalid destination.
UnsupportedOperationException - if a client uses this method with a MessageProducer that specified a destination at creation time.
And when a message is not acknowledged by the consumer, the JMS provider retains the message and delivers it the next time again, till an acknowledgement is received (unless, the Ack Mode is AUTO_ACKNOWLEDGE in which case, a delivery to the consumer is automatically acknowledged.
Googling doesn't make you a genius. But not Googling makes you dumber.
Thank you Prabhaharan. I was wrong in assuming that even during message production the JMS provider acknowledges receipt of a message.
Thank you for all your inputs, it cleared many of my doubts especially
The Queue Session has Acknowledgement mode as one of it's parameters because you can create consumers/producers alike from a session and the Ack Mode affects only the consumer
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop