activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chudak <meadand...@gmail.com>
Subject Re: Rolled back messages never get redelivered
Date Mon, 14 Dec 2009 21:19:21 GMT

I figured this out but it was in no way obvious...

I had to add this to the DMLC:

<property name="cacheLevelName" value="CACHE_CONSUMER"/>

Hope this helps someone else avoid wasting a whole day..

Charles


chudak wrote:
> 
> I'm having a problem with message redelivery.
> 
> I'm using:
> 
> ActiveMQ 5.3.0
> Spring 2.5.6
> Spring Integration 1.0
> Atomikos 3.5.9
> 
> If I send a 'broken' message to my queue, the transaction rolls back
> correctly but it NEVER gets redelivered even if I restart both the client
> (application) and the broker. Subsequently valid messages get delivered
> just fine but it seems that this broken message never gets redelivered.
> The message shows as 'redelivered' in the activemq web admin even though
> my logs only show it having been delivered one time and being rolled back.
> 
> I'm using the default activemq broker configuration (out of the box) with
> the following spring configuration:
> 
> <bean id="queueConnectionFactoryBean"
> class="org.springframework.jms.connection.SingleConnectionFactory"
> destroy-method="destroy">
>     <constructor-arg>
>       <bean class="com.atomikos.jms.QueueConnectionFactoryBean"
> init-method="init">
>         <property name="xaQueueConnectionFactory"
> ref="queueConnectionFactoryXa"/>
>       </bean>
>     </constructor-arg>
>     <property name="reconnectOnException" value="true"/>
>   </bean>
>   
>   <bean id="queueConnectionFactoryXa"
> class="org.apache.activemq.ActiveMQXAConnectionFactory">
>     <property name="brokerURL" value="${activemq.url}"/>
>     <!--  Set prefetch to 1 to prevent message rollback from preventing
> message redelivery.
>         See http://activemq.apache.org/what-is-the-prefetch-limit-for.html
> for more information 
>     -->
>     <property name="prefetchPolicy">
>       <bean class="org.apache.activemq.ActiveMQPrefetchPolicy">
>         <property name="queuePrefetch" value="0"/>
>       </bean>
>     </property>
>     <property name="redeliveryPolicy">
>       <bean class="org.apache.activemq.RedeliveryPolicy">
>         <property name="initialRedeliveryDelay" value="1000"/>
>         <property name="maximumRedeliveries" value="10"/>
>         <property name="useExponentialBackOff" value="false"/>
>       </bean>
>     </property>
>   </bean>
> 
>   <bean id="gatewayMessageListenerContainer"
> class="org.springframework.jms.listener.DefaultMessageListenerContainer"
>         depends-on="transactionManager">
>       <property name="connectionFactory"
> ref="queueConnectionFactoryBean"/>
>       <property name="transactionManager" ref="transactionManager"/>
>       <property name="destination" ref="gatewayMessageDestination"/>
>       <property name="sessionTransacted" value="true"/>
>       <property name="maxConcurrentConsumers" value="5"/>
>       <property name="concurrentConsumers" value="1"/>
>       <property name="receiveTimeout" value="5000"/>
>       <property name="recoveryInterval" value="60000"/>
>       <property name="autoStartup" value="true"/>
>   </bean>
>   
>   <!-- Inbound Gateway Channel adapter -->
>   <jms:message-driven-channel-adapter id="gatewayMessageAdapter" 
>                                       channel="gatewayMessageChannel" 
>                                      
> container="gatewayMessageListenerContainer"/>
> 
> I see the message rollback in the application logs:
> 
> 2009-12-14 11:41:11,236 DEBUG
> [org.springframework.jms.listener.DefaultMessageListenerContainer][AbstractPollingMessageListenerContainer.java:328]
> Rolling back transaction because of listener exception thrown:
> org.springframework.integration.message.MessageDeliveryException: failed
> to send Message to request channel
> 2009-12-14 11:41:11,237 WARN 
> [org.springframework.jms.listener.DefaultMessageListenerContainer][AbstractMessageListenerContainer.java:646]
> Execution of JMS message listener failed
> org.springframework.integration.message.MessageDeliveryException: failed
> to send Message to request channel
> 	at
> org.springframework.integration.jms.ChannelPublishingJmsMessageListener.onMessage(ChannelPublishingJmsMessageListener.java:205)
> 	at
> org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:518)
> 	at
> org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:479)
> 	at
> org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:451)
> 	at
> org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:323)
> 	at
> org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:241)
> 	at
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:982)
> 	at
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:974)
> 	at
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:876)
> 	at java.lang.Thread.run(Thread.java:619)
> 2009-12-14 11:41:11,238 DEBUG
> [org.springframework.transaction.jta.JtaTransactionManager][AbstractPlatformTransactionManager.java:682]
> Transactional code has requested rollback
> 2009-12-14 11:41:11,238 DEBUG
> [org.springframework.transaction.jta.JtaTransactionManager][AbstractPlatformTransactionManager.java:821]
> Initiating transaction rollback
> 2009-12-14 11:41:11,240 DEBUG
> [org.apache.activemq.TransactionContext][TransactionContext.java:416]
> Rollback: das_eai_web_tm0009600001das_eai_web_tm96
> 
> 
> And in the ActiveMQ log:
> 
> 2009-12-14 11:41:11,241 | DEBUG | XA Transaction rollback:
> XID:1096044365:6461735f6561695f7765625f746d30303039363030303031:6461735f6561695f7765625f746d3936
> | org.apache.activemq.transaction.XATransaction | ActiveMQ Transport:
> tcp:///127.0.0.1:46357
> 
> One odd thing I notice is that the InFlight value is negative...and
> decrements by 1 everytime one of these bogus messages rolls back.
> 
> Anyone have any ideas what is wrong with my configuration? Why won't these
> rolled back messages redeliver?
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Rolled-back-messages-never-get-redelivered-tp26779979p26780000.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message