users@glassfish.java.net

Setting AcknowledgeMode on a Session (Direct)

From: Robert Weeks <RWeeks_at_ext-inc.com>
Date: Tue, 22 Mar 2011 13:10:10 -0700

Hello -

Using GF3.1, when trying to set an AcknowledgeMode on a session, it never seems to stick.

I am pulling a ConnectionFactory from jndi for us:

   create-jms-resource --restype javax.jms.QueueConnectionFactory --description "QueueConnectionFactory" jms/ExtQueueConnectionFactory

When I get this back - it reports as: com.sun.messaging.jms.ra.DirectConnectionFactory

Then - trying to create a session with CLIENT_ACKNOWLEDGE and then immediately testing it:


Session session = connection.createSession(false, Session.CLIENT_ACKNOWLEDGE);
This results in the object:
>> SESSION: com.sun.messaging.jms.ra.DirectTransactionManagedSession_at_967e07


Checking transacted (log.error(" >> Are we transacted? " + session.getTransacted())) we get:
>> Are we transacted? false

Then immediately trying to get what the acknowledgeMode is on the session we just created:
     session.getAcknowledgeMode(): 1 (AUTO_ACKNOWLEDGE)

If I write an app and connect to the message queue non-direct (via mq://127.0.0.1:7676), this works fine - but that is not returning the DirectConnectionFactory nor the DirectConnection - and the session is slightly different too.

It appears that the session is not transacted (which is right) - but I cannot get the setting of the ack mode to be correct here.

Is there something I am missing?

Thanks for any information.






Robert Weeks
Senior Software Developer
EXTENSION, INC.
Email: rweeks_at_ext-inc.com
Office: 260-797-0200 x4228
General: 877-207-3753
www.OpenTheRedBox.com

Download the FREE EXTENSION Mobile App for iPhone and iPod Touch
http://www.opentheredbox.com/iPhone_appDemo.php

Email us at demo_at_ext-inc.com <mailto:demo_at_ext-inc.com> to pre-schedule a LIVE demo for our HealthAlert for Nurses solution at the AONE Conference in San Diego. Visit us at booth #118