activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From spiiff <matthias.ba...@siemens.com>
Subject Re: AMQ 5.1 - Re-queued msg are redelivered again after restart
Date Mon, 24 Mar 2008 15:59:25 GMT

Hi,
in the JMS spec the following is specified:

"It is possible for a listener to throw a RuntimeException; however, this is
considered a client programming error. Well-behaved listeners should catch
such exceptions and attempt to divert messages causing them to some form of
application-specific ‘unprocessable message’ destination.
The result of a listener throwing a RuntimeException depends on the
session’s
acknowledgment mode.
• AUTO_ACKNOWLEDGE or DUPS_OK_ACKNOWLEDGE - the message
will be immediately redelivered. The number of times a JMS provider will
redeliver the same message before giving up is provider-dependent. The
JMSRedelivered message header field will be set for a message redelivered
under these circumstances"

But the messages are only redelivered after restarting the broker.
I also habe problems with this behaviour, becaue my colleagues are throwing
RuntimExceptions into my onMessage method  :-(
I expected the message to be redelivered asap.
What is the state about this issue?
Has a jira been raised?

best regards,
Matthias


rajdavies wrote:
> 
> 
> On 29 Feb 2008, at 06:18, DinDon wrote:
> 
>>
>> Hello guys,
>>
>> I am new to JMS and ActiveMQ(apache- 
>> activemq-5.1-20080220.151243-27), and I
>> have been testing ActiveMQ with SpringJMS and Jencks for a week, and  
>> googled
>> with no luck for the following issues.
>>
>> - Re-queued messages only being redelivered after restarting AMQ
>> - In my MessageListener.onMessage(Message message) method, I throw a
>> RuntimeException() for testing redelivery.
>>
>> Here is the Spring Config which I followed some tutorials:
>>
>> 	<bean id="jmsTransactionManager"
>> 		class="org.jencks.factory.TransactionManagerFactoryBean" />
>>
>> 	<bean id="connectionManager"
>> 		class="org.jencks.factory.ConnectionManagerFactoryBean">
>> 		<property name="transactionManager" ref="jmsTransactionManager" />
>> 	</bean>
>>
>> 	<bean id="jmsResourceAdapter"
>> 		class="org.apache.activemq.ra.ActiveMQResourceAdapter">
>> 		<property name="serverUrl" value="${pms.mq.serverUrl}" />
>> 		<property name="userName" value="${pms.mq.userName}" />
>> 		<property name="password" value="${pms.mq.password}" />
>> 		<property name="initialRedeliveryDelay" value="5" />
>> 		<property name="maximumRedeliveries" value="2" />
>> 	</bean>
>>
>> 	<bean id="jmsManagedConnectionFactory"
>> 		class="org.apache.activemq.ra.ActiveMQManagedConnectionFactory">
>> 		<property name="resourceAdapter" ref="jmsResourceAdapter" />
>> 		<property name="initialRedeliveryDelay" value="10" />
>> 		<property name="maximumRedeliveries" value="2" />
>> 	</bean>
>>
>> 	<bean id="jmsConnectionFactory"
>> 		class="org.jencks.factory.ConnectionFactoryFactoryBean">
>> 		<property name="managedConnectionFactory"
>> 			ref="jmsManagedConnectionFactory" />
>> 		<property name="connectionManager" ref="connectionManager" />
>> 	</bean>
>>
>> 	<bean id="jmsTemplate"
>> 		class="org.springframework.jms.core.JmsTemplate">
>> 		<property name="connectionFactory">
>> 			<ref bean="jmsConnectionFactory" />
>> 		</property>
>> 	</bean>
>>
>> 	<bean id="jencks" class="org.jencks.JCAContainer"
>> 		depends-on="jmsConnectionFactory">
>> 		<property name="transactionManager" ref="jmsTransactionManager" />
>> 		<property name="threadPoolSize" value="25" />
>> 		<property name="resourceAdapter" ref="jmsResourceAdapter" />
>> 	</bean>
>>
>> 	<bean id="mailingQueueMessageListener"
>> 		class="com.ifshk.pms.jms.MailingQueueMessageListener" />
>>
>> 	<bean id="inputQueueMessageListenerContainer"
>> 		 
>> class 
>> ="org.springframework.jms.listener.DefaultMessageListenerContainer"
>> 		lazy-init="false">
>> 		<property name="connectionFactory" ref="jmsConnectionFactory" />
>> 		<property name="destinationName" value="${mailing.queue.name}" />
>> 		<property name="messageListener"
>> 			ref="mailingQueueMessageListener" />
>> 		<property name="transactionManager" ref="jmsTransactionManager" />
>> 		<property name="sessionTransacted" value="true" />
>> 	</bean>
>>
>> 	<!--
>> 		<bean id="inboundConnectorA" class="org.jencks.JCAConnector">
>> 		<property name="jcaContainer" ref="jencks" />
>> 		<property name="activationSpec">
>> 		<bean
>> 		class="org.apache.activemq.ra.ActiveMQActivationSpec">
>> 		<property name="destination" value="${mailing.queue.name}" />
>> 		<property name="destinationType"
>> 		value="javax.jms.Queue" />
>> 		</bean>
>> 		</property>
>> 		<property name="ref" value="mailingQueueMessageListener" />
>> 		</bean>
>> 	-->
>>
>> Initially, I used inboundConnectorA for receiving Message, but it  
>> seems
>> jencks doesn't rollback a message automatically when an exception  
>> occurs. So
>> I switched to DefaultMessageListenerContainer, and rollback does  
>> work but
>> the re-queued messages only being redelivered again after I restart  
>> AMQ, and
>> those messages never be marked as DEAD and sent to a dead queue.
>>
>> Please advice.
>>
>> Thanks a lot & regards,
>> -- 
>> View this message in context:
>> http://www.nabble.com/AMQ-5.1---Re-queued-msg-are-redelivered-again-after-restart-tp15752828s2354p15752828.html
>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>
> 
> Odd - best raise a jira!
> 
> 

-- 
View this message in context: http://www.nabble.com/AMQ-5.1---Re-queued-msg-are-redelivered-again-after-restart-tp15752828s2354p16254960.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message