Changing the acknowledgement mode for a JMS session in WebSphere Application Server Version 5
 Technote (FAQ)
 
Problem
The JMS 1.0.2 specification lists three acknowledgement modes for a JMS session: AUTO_ACKNOWLEDGE, CLIENT_ACKNOWLEDGE, and DUPS_OK_ACKNOWLEDGE. Applications running in IBM® WebSphere® Application Server Version 5 can specify the acknowledgement mode in the createQueueSession call. For example:

QueueSession session = jmsconn.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);


However, if the JMS connection factory that was used to get a connection is defined in the WebSphere Application Server namespace (this is the case if it is created in the administrative console), the application server overrides the acknowledgement mode and always uses AUTO_ACKNOWLEDGE. This is done to prevent problems that can occur if an application tries to acknowledge a message that has already been acknowledged by a Application Server container.
 
Solution
Using the CLIENT_ACKNOWLEDGE or DUPS_OK_ACKNOWLEDGE modes is not recommended. However, if necessary, you can use these modes.

To do this, the application must not look up the JMS connection factory or JMS destination from the Application Server JNDI namespace. Instead, it must create the JMS connection factory and JMS destination programmatically.

Details on how to create the JMS resources programmatically are located in Chapter 10 of the WebSphere MQ Using Java™ manual (PDF 1665 KB).

When the JMS resources are created programmatically, the acknowledgement mode can be set to CLIENT_ACKNOWLEDGE or DUPS_OK_ACKNOWLEDGE in the createQueueSession call, and it will not be overridden by WebSphere Application Server. The application is then responsible for the message acknowledgement.

 
 
Cross Reference information
Segment Product Component Platform Version Edition
Application Servers Runtimes for Java Technology Java SDK
 
 


Document Information


Product categories: Software > Application Servers > Distributed Application & Web Servers > WebSphere Application Server > Java Message Service (JMS)
Operating system(s): Windows
Software version: 5.1.1.4
Software edition:
Reference #: 1204423
IBM Group: Software Group
Modified date: Apr 25, 2005