activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dnn <Daniel.Nawro...@ngc.com>
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
https://issues.apache.org/activemq/browse/AMQ-2712.  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"
useJmsPriority="true">
      <!-- pretty standard stuff goes here, has been truncated -->
   </amq:broker>

   <bean id="jmsConnectionFactory"
         class="bitronix.tm.resource.jms.PoolingConnectionFactory"
         destroy-method="close"
         depends-on="amqBroker"
   >
      <property name="uniqueName" value="activemq-xa" />
      <property name="className"
value="org.apache.activemq.ActiveMQXAConnectionFactory" />
      <property name="maxPoolSize" value="1000" />
      <property name="driverProperties">
         <props>
            <prop key="brokerURL">vm://localhost?create=false</prop>
         </props>
      </property>
   </bean>

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

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: http://old.nabble.com/QueueBrowser-in-XA-Transaction--tp28341411p28344039.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message