activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dnn <>
Subject Re: QueueBrowser in XA Transaction?
Date Fri, 23 Apr 2010 17:11:17 GMT

Gary Tully wrote:
> Ah, ok, so that exception is the only way you know that it is not
> working...
> an XASession is transacted so it does require an active XA transaction.
> Best post your entire spring context and maybe post to camel-users who
> will
> be more familiar with the <transacted> tag

I get the first exception when in the destroyConsumer() method, but I am
getting another exception that causes the enumeration.getNextElement() to
return null.  I've documented both of them and included a unit test at  I basically copied the
existing JmsQueueBrowserTest, made all the sessions transacted, and added a
test case where no messages are added to the queue.  If I made an error
setting up the transacted sessions, let me know and I can update the unit
test.  I'm not too familiar with the core AMQ API as I have been using JMS.

My Spring setup is:

   <amq:broker id="amqBroker" useJmx="true" start="false"
      <!-- pretty standard stuff goes here, has been truncated -->

   <bean id="jmsConnectionFactory"
      <property name="uniqueName" value="activemq-xa" />
      <property name="className"
value="org.apache.activemq.ActiveMQXAConnectionFactory" />
      <property name="maxPoolSize" value="1000" />
      <property name="driverProperties">
            <prop key="brokerURL">vm://localhost?create=false</prop>

   <!-- Spring JMS template -->
   <bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
      <property name="connectionFactory" ref="jmsConnectionFactory" />
      <property name="sessionTransacted" value="true" />

Going forward, I will simply use a non-XA connection for the QueueBrowser. 
I'll have to manually handle the scenario where another transaction owned by
another process/thread consumes a message after I've browsed it.
View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message