activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bish, Tim" <Tim.B...@Sensis.com>
Subject RE: Difference between JMS and CMS Connection::createSession
Date Fri, 08 Jun 2007 15:22:28 GMT

It's a simplification of the interface.  We have transacted as an ack
mode as you must use Auto Ack when in transacted so to avoid confusion
we eliminated the bool.

> -----Original Message-----
> From: Albert Strasheim [mailto:13640887@sun.ac.za]
> Sent: Friday, June 08, 2007 11:07 AM
> To: dev@activemq.apache.org
> Subject: Difference between JMS and CMS Connection::createSession
> 
> Hello all
> 
> I just noticed that there is a slight difference between JMS
> and CMS with regards to Connection::createSession.
> 
> JMS takes a boolean indicating whether the session is transacted,
> followed by an int for the acknowledge mode.
> 
> CMS just takes an int for the acknowledge mode.
> 
> ActiveMQConnection does the following:
> 
> public Session createSession(boolean transacted,int acknowledgeMode)
> throws JMSException{
>   checkClosedOrFailed();
>   ensureConnectionInfoSent();
>   boolean
doSessionAsync=alwaysSessionAsync||sessions.size()>0||transacted
>       ||acknowledgeMode==Session.CLIENT_ACKNOWLEDGE;
>   return new
>
ActiveMQSession(this,getNextSessionId(),(transacted?Session.SESSION_TRAN
SA
> CTED
> 
>
:(acknowledgeMode==Session.SESSION_TRANSACTED?Session.AUTO_ACKNOWLEDGE:a
ck
> nowledgeMode)),
>       dispatchAsync,alwaysSessionAsync);
> }
> 
> so transacted=true always means to AUTO_ACKNOWLEDGE as the acknowledge
> mode, otherwise use the acknowledgde mode specified by the user.
> 
> Is there a reason why the CMS API doesn't exactly mirror the JMS API
in
> this case? It might be worth it, for consistency's sake.
> 
> Cheers,
> 
> Albert
> 
> P. S. By the way, does the Java code check whether the specified
> acknowledge mode is valid?

Mime
View raw message