activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From DinDon <qq...@hotmail.com>
Subject AMQ 5.1 - Re-queued msg are redelivered again after restart
Date Fri, 29 Feb 2008 06:18:16 GMT

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.


Mime
View raw message