activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nathan Mittler" <nathan.mitt...@gmail.com>
Subject Re: Difference between JMS and CMS Connection::createSession
Date Fri, 08 Jun 2007 15:21:23 GMT
Actually, transacted sessions always get assigned an ack mode of
SESSION_TRANSACTED, regardless what was passed in for the ack mode.

We modeled that method after the NMS API.  I think the two parameters are
somewhat redundant, since you can't have a transacted session with a
CLIENT_ACK mode.  If it's transacted, the mode always has to be
SESSION_TRANSACTED.  Personally, I think that's an ugly in the JMS API that
is made a bit cleaner in NMS/CMS.

Nate

On 6/8/07, Albert Strasheim <13640887@sun.ac.za> wrote:
>
> 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_TRANSACTED
>       :(acknowledgeMode==
> Session.SESSION_TRANSACTED?Session.AUTO_ACKNOWLEDGE:acknowledgeMode)),
>       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
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message