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 14:27:38 GMT


Gary Tully wrote:
> 
> this seems to be another case of
> https://issues.apache.org/activemq/browse/AMQ-2659 and you also have a
> valid
> use case.
> 

That's certainly an interesting bug, but I don't think it applies to me.  An
XA transaction definitely should have been started.  The camel route that
start the whole shebang is:

<route>
   <from uri="timer:test?period=1000 />
   <transacted />
   <to uri="myQueueBrowser" />
</route>

As I understand it, the <transacted/> tag will start a transaction because
none is currently active for the thread (I'm using PROPAGATION_REQUIRED). 
Inside the myQueueBrowser processor, I am using the following code:

      jmsTemplate.browse( getSourceQueue(), new BrowserCallback()
      {
         @Override
         public Object doInJms( Session session, QueueBrowser browser )
throws JMSException
         {
            Enumeration< ? > e = browser.getEnumeration();
            while( e.hasMoreElements() )
            {
               Object o = e.nextElement();
               // do some stuff with the message
            }
            return null;
         }
      } );

Where jmsTemplate is an instance of the Spring JmsTemplate class with
sessionTransacted=true.  From the Spring code, it appears to be using
PROPAGATION_REQUIRED, which will join the transaction started in the Camel
route.

I can post my Spring configuration if anyone thinks it will help.
-- 
View this message in context: http://old.nabble.com/QueueBrowser-in-XA-Transaction--tp28341411p28342060.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message