You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Mattias Jiderhamn <mj...@expertsystems.se> on 2012/11/01 23:11:10 UTC

Why are acks sent after rollback???

I'm trying to find the correct configuration for our first JMS setup, 
using JTA transactions for our consumer. I am unable to get redelivery 
(on RuntimeException) working, when using JTA. Using non-XA config works 
however.

Doing a bit (understatement...) of digging, I have concluded that 
TransactionContext.rollback(Xid) is properly invoked and the rollback 
command has been sent to the broker. However, after that has been done, 
the synchronization registered in 
org.apache.activemq.ActiveMQMessageConsumer.close() is invoking 
doClose(), which in turn calls dispose() and then - because 
!session.getTransacted() - deliverAcks() which I suppose is why 
redelivery does not work.

But why does this happen???
Should session.getTransacted() really be false during rollback...?

Snippets from my Spring config:

   <bean id="jmsXaConnectionFactory" 
class="org.apache.activemq.pool.XaPooledConnectionFactory" 
destroy-method="stop">
     <property name="connectionFactory">
       <bean class="org.apache.activemq.ActiveMQXAConnectionFactory" 
p:brokerURL="${brokerUrl}" />
     </property>
     <property name="transactionManager" ref="jtaTransactionManager" />
   </bean>

   <bean 
class="org.springframework.jms.listener.DefaultMessageListenerContainer" 
p:connectionFactory-ref="jmsXaConnectionFactory"
         p:transactionManager-ref="transactionManager"
         p:destination="..." p:messageListener="..." />

I'm using ActiveMQ 5.6.0

-- 

   </Mattias>