activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Imagine_David <yh...@163.com>
Subject Re: 'redeliveryPolicy doesn't work' or 'message won't remove after consumed' either of them will happen
Date Wed, 29 Oct 2008 01:23:02 GMT

mysql version is 5.0

here is my config file:

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:amq="http://activemq.org/config/1.0"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
 http://activemq.org/config/1.0
http://activemq.apache.org/schema/core/activemq-core-5.0.0.xsd">
	
	<bean id="jmsConnectionFactory"
        class="org.apache.activemq.ActiveMQConnectionFactory">
        <property name="brokerURL" value="tcp://localhost:61616" /><!-- auto
reconnect activemq example --><!--
failover:(tcp://localhost:61616,tcp://remotehost:61616)?initialReconnectDelay=100
-->
        <property name="redeliveryPolicy" ref="redeliveryPolicy" />
	</bean>
	
	<bean id="redeliveryPolicy" class="org.apache.activemq.RedeliveryPolicy">
		<property name="initialRedeliveryDelay" value="20000" />
		<property name="maximumRedeliveries" value="2" />
		<!--
		<property name="useExponentialBackOff" value="true" />
		<property name="backOffMultiplier" value="2" />
		-->
	</bean>

    <!--  ActiveMQ destinations  -->
    <amq:queue name="destination" physicalName="JMS-TEST-QUEUE" />

	<!--  Spring JmsTemplate config -->
	<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
		<property name="connectionFactory">
			<!--  lets wrap in a pool to avoid creating a connection per send -->
			<bean class="org.springframework.jms.connection.SingleConnectionFactory">
				<property name="targetConnectionFactory" ref="jmsConnectionFactory" />
			</bean>
		</property>
		<!-- custom MessageConverter -->
		<property name="messageConverter" ref="defaultMessageConverter" />
	</bean>

	<!-- converter  -->
	<bean id="defaultMessageConverter"
class="com.bc.activemq.DefaultMessageConverter" />

	<!-- POJO which send Message uses  Spring JmsTemplate -->
	<bean id="queueMessageProducer"
class="com.bc.activemq.services.producer.AcceptContactorServiceProd">
		<property name="template" ref="jmsTemplate" />
		<property name="destination" ref="destination" />
	</bean>

	<!--  Message Driven POJO (MDP) -->
    <!-- consumer for queue -->
    <bean id="queueConsumer"
class="com.bc.activemq.services.consumer.AcceptContactorServiceCons" />

    <!-- Message Listener for  -->
    <bean id="queueListener"
class="org.springframework.jms.listener.adapter.MessageListenerAdapter">
		<constructor-arg ref="queueConsumer" />
		<!--  may be other method -->
		<property name="defaultListenerMethod" value="execute" />
		<!-- custom MessageConverter define -->
		<property name="messageConverter" ref="defaultMessageConverter" />
	</bean>

    <!--  listener container´╝îMDP -->
    <bean id="queueListenerContainer"
class="org.springframework.jms.listener.DefaultMessageListenerContainer">
		<property name="connectionFactory" ref="jmsConnectionFactory" />
		<property name="destination" ref="destination" />
		<property name="messageListener" ref="queueListener" />
		<property name="maxMessagesPerTask" value="1" />
		<property name="sessionTransacted" value="true" />
		<property name="transactionManager" ref="jmsTransactionManager" />
		<property name="recoveryInterval" value="10000" />
		<property name="receiveTimeout" value="20000" />
	</bean>
	
	<bean id="jmsTransactionManager"
class="org.springframework.jms.connection.JmsTransactionManager">
		<property name="connectionFactory" ref="jmsConnectionFactory" />
	</bean>
</beans>

David


Imagine_David wrote:
> 
> thank you for replied.
> 
> my program environment:
> activemq5.1
> spring2.0
> non-embeded activemq
> jdbcPersistenceAdapter(mysql) which deploy at
> 'ACTIVEMQ_HOME/conf/activemq.xml'
> 
> David
> 
> 
> James.Strachan wrote:
>> 
>> 2008/10/28 Imagine_David <yhj40@163.com>:
>>>
>>> i use activemq in spring web project.
>>> at first, i use 'sessionTransacted=true' in
>>> 'DefaultMessageListenerContainer'. the redeliveryPolicy was working
>>> fine!
>>> but after done to consume message, the message in db wasn't remove.
>> 
>> What persistence mechanism are you using with ActiveMQ? What version?
>> 
>> -- 
>> James
>> -------
>> http://macstrac.blogspot.com/
>> 
>> Open Source Integration
>> http://fusesource.com/
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/%27redeliveryPolicy-doesn%27t-work%27-or-%27message-won%27t-remove-after-consumed%27-either-of-them-will-happen-tp20208421p20219336.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message