activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Albert Strasheim <13640...@sun.ac.za>
Subject Difference between JMS and CMS Connection::createSession
Date Fri, 08 Jun 2007 15:06:56 GMT
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
View raw message