View Full Version : Bug in method doReceive method of JmsTemplate class
mubashir
Sep 17th, 2004, 08:55 PM
In doReceive method of JmsTemplate class every message is acknowledged regardless of what SessionAcknowledgeMode property is set. It caused exception when I used Websphere MQ with SessionAcknowledgeMode property set as AUTO_ACKNOWLEDGE. I had to set it to CLIENT_ACKNOWLWDGE to escape the exception.
robh
Sep 18th, 2004, 05:01 AM
Can you post this as bug report on JIRA along with the error you received and, if possible, relevant snippets from your code?
Much appreciated!
Rob
Juergen Hoeller
Sep 18th, 2004, 09:32 AM
Note that the JMS spec says the following (JMS 1.1, section 3.6):
"All JMS messages support the acknowledge method for use when a client has specified that a JMS consumer’s messages are to be explicitly acknowledged.
If a client uses automatic acknowledgment, calls to acknowledge are ignored."
So it should be OK to call acknowledge in any case - it seems that WebSphere JMS is misbehaving here.
Nevertheless, we can check for the JMS Session for CLIENT_ACKNOWLEDGE and just call acknowledge in that case. This should also work with WebSphere JMS.
Juergen
Juergen Hoeller
Sep 18th, 2004, 03:05 PM
Nevertheless, we can check for the JMS Session for CLIENT_ACKNOWLEDGE and just call acknowledge in that case. This should also work with WebSphere JMS.
I've just added such a check: On JMS 1.1, it checks session.getAcknowledgeMode(); on JMS 1.0.2, it checks the setting on the template (which will work in all usual cases too).
Juergen
vBulletin® v3.7.3, Copyright ©2000-2008, Jelsoft Enterprises Ltd.