I have an application which takes part in a XA Transaction. The application should
1) Dequeue message 2) Process message 3) Persist message to database. All of these steps work fine. The problem is at step 2 I am throwing a runtime exception to test message rollback. Upon throwing the exception, I clearly see that the transaction has rolled back and that nothing has been persisted. The only problem is once the message is put back onto the queue it should stop trying to resend the message after 3 attempts. So far it has got up to 453 retries and still continues. From what I can see it is ignoring my ReDelivery policy which I have set up. I can make the application work by manually checking the “redelivery counter” property on the message and stopping processing if this value exceeds 3 but would prefer to get the listener to do this for me. My context file is as so <beans> <bean id="jotm" class="org.springframework.transaction.jta.JotmFactoryBean" /> <bean id="jotmTransactionManager" class="org.springframework.transaction.jta.JtaTransactionManager" autowire="constructor"> <property name="userTransaction" ref="jotm" /> </bean> <bean id="jmsFactory2" class="org.apache.activemq.ActiveMQXAConnectionFactory"> <property name="brokerURL" value="tcp://localhost:61616" /> <property name="redeliveryPolicy"> <bean class="org.apache.activemq.RedeliveryPolicy"> <property name="initialRedeliveryDelay" value="600" /> <property name="maximumRedeliveries" value="3" /> </bean> </property> </bean> <bean id="jmsConnectionFactory2" class="org.jencks.pool.PooledSpringXAConnectionFactory"> <property name="connectionFactory" ref="jmsFactory2" /> <property name="jtaTransactionManager" ref="jotmTransactionManager" /> </bean> <bean id="destination" class="org.apache.activemq.command.ActiveMQQueue"> <constructor-arg value="defaultQueue" /> </bean> <bean id="listenerContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer"> <property name="concurrentConsumers" value="5" /> <property name="connectionFactory" ref="jmsConnectionFactory2" /> <property name="destination" ref="destination" /> <property name="messageListener" ref="myMessageProcessor" /> <!--<property name="sessionTransacted" value="true" /> --><property name="transactionManager" ref="jotmTransactionManager" /> </bean> <bean id="myMessageProcessor" class="test.MyMessageProcessorSimple"> <property name="jmsTemplate"> <bean class="org.springframework.jms.core.JmsTemplate"> <property name="connectionFactory" ref="jmsFactory2" /> <property name="defaultDestinationName" value="defaultQueue" /> </bean> </property> </bean> <bean id="activeMqConnectionFactory" class="org.apache.activemq.spring.ActiveMQConnectionFactory"> <property name="brokerURL" value="tcp://localhost:61616" /> </bean> <bean id="connectionFactory" class="org.springframework.jms.connection.SingleConnectionFactory"> <property name="targetConnectionFactory" ref="activeMqConnectionFactory" /> </bean> <bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate"> <property name="connectionFactory" ref="connectionFactory" /> <property name="defaultDestinationName" value="defaultQueue" /> <property name="pubSubDomain" value="false" /> </bean> <bean id="queueSender" class="test.SampleSender"> <property name="jmsTemplate" ref="jmsTemplate" /> </bean> </beans> The message processor public void onMessage(Message msg) { String message="NOT_SET"; try { message = ((TextMessage) msg).getText(); } catch (JMSException e) { e.printStackTrace(); } System.out.println("message=" + message); throw new RuntimeException("ROLLBACK TEST...."); } -- View this message in context: http://www.nabble.com/RedeliveryPolicy-appears-to-get-ignored-in-an-XA-Transaction-tf3833202s2354.html#a10852032 Sent from the ActiveMQ - User mailing list archive at Nabble.com.