You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by IBeaumont <ib...@cdcsoftware.com> on 2011/05/20 19:17:54 UTC

Session.SESSION_TRANSACTED in example code wrong??

I'm looking at the Vendor.java sample that comes with ActiveMQ.

It does...
connection.createSession(true, Session.SESSION_TRANSACTED);

Reading the docs...
http://download.oracle.com/javaee/1.4/api/javax/jms/Connection.html#createSession%28boolean,%20int%29

that isn't a valid value for create session.  Valid values are:
    Session.AUTO_ACKNOWLEDGE, Session.CLIENT_ACKNOWLEDGE,
Session.DUPS_OK_ACKNOWLEDGE

Looking at the defined values...
public static final int 	AUTO_ACKNOWLEDGE 	1
public static final int 	CLIENT_ACKNOWLEDGE 	2
public static final int 	DUPS_OK_ACKNOWLEDGE 	3
public static final int 	SESSION_TRANSACTED 	0

it is therefore passing an invalid value of zero to the createSession.

So is the sample wrong, and therefore also ActiveMQ wrong for accepting it?

--
View this message in context: http://activemq.2283324.n4.nabble.com/Session-SESSION-TRANSACTED-in-example-code-wrong-tp3539083p3539083.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Session.SESSION_TRANSACTED in example code wrong??

Posted by Brendan Long <br...@realgo.com>.
Right before listing valid values, it says "ignored if the session is
transacted.", so any value is legal in that case. The person writing the
example probably though that Session.SESSION_TRANSACTED was more clear
than null.

On 5/20/2011 11:17 AM, IBeaumont wrote:
> I'm looking at the Vendor.java sample that comes with ActiveMQ.
>
> It does...
> connection.createSession(true, Session.SESSION_TRANSACTED);
>
> Reading the docs...
> http://download.oracle.com/javaee/1.4/api/javax/jms/Connection.html#createSession%28boolean,%20int%29
>
> that isn't a valid value for create session.  Valid values are:
>     Session.AUTO_ACKNOWLEDGE, Session.CLIENT_ACKNOWLEDGE,
> Session.DUPS_OK_ACKNOWLEDGE
>
> Looking at the defined values...
> public static final int 	AUTO_ACKNOWLEDGE 	1
> public static final int 	CLIENT_ACKNOWLEDGE 	2
> public static final int 	DUPS_OK_ACKNOWLEDGE 	3
> public static final int 	SESSION_TRANSACTED 	0
>
> it is therefore passing an invalid value of zero to the createSession.
>
> So is the sample wrong, and therefore also ActiveMQ wrong for accepting it?
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/Session-SESSION-TRANSACTED-in-example-code-wrong-tp3539083p3539083.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.


RE: Session.SESSION_TRANSACTED in example code wrong??

Posted by "Idzerda, Edan" <Ed...@PremierInc.com>.
Maybe that page is wrong, SESSION_TRANSACTED is part of Session...   

http://download.oracle.com/javaee/1.4/api/javax/jms/Session.html#SESSION_TRANSACTED

-----Original Message-----
From: IBeaumont [mailto:ibeaumont@cdcsoftware.com] 
Sent: Friday, May 20, 2011 1:18 PM
To: users@activemq.apache.org
Subject: Session.SESSION_TRANSACTED in example code wrong??

I'm looking at the Vendor.java sample that comes with ActiveMQ.

It does...
connection.createSession(true, Session.SESSION_TRANSACTED);

Reading the docs...
http://download.oracle.com/javaee/1.4/api/javax/jms/Connection.html#createSession%28boolean,%20int%29

that isn't a valid value for create session.  Valid values are:
    Session.AUTO_ACKNOWLEDGE, Session.CLIENT_ACKNOWLEDGE, Session.DUPS_OK_ACKNOWLEDGE

Looking at the defined values...
public static final int 	AUTO_ACKNOWLEDGE 	1
public static final int 	CLIENT_ACKNOWLEDGE 	2
public static final int 	DUPS_OK_ACKNOWLEDGE 	3
public static final int 	SESSION_TRANSACTED 	0

it is therefore passing an invalid value of zero to the createSession.

So is the sample wrong, and therefore also ActiveMQ wrong for accepting it?

--
View this message in context: http://activemq.2283324.n4.nabble.com/Session-SESSION-TRANSACTED-in-example-code-wrong-tp3539083p3539083.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
-----------------------------------------
***Note:The information contained in this message may be privileged
and confidential and protected from disclosure. If the reader of
this message is not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient,
you are hereby notified that any dissemination, distribution or
copying of this communication is strictly prohibited.  If you have
received this communication in error, please notify the Sender
immediately by replying to the message and deleting it from your
computer.  Thank you.  Premier Inc.