activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Veit Guna (JIRA)" <>
Subject [jira] Commented: (AMQ-1847) Redelivery on a failure doesn't respect the initialRedeliveryDelay on the first attempt.
Date Wed, 09 Jul 2008 06:45:00 GMT


Veit Guna commented on AMQ-1847:

Thanks Claus.

Sure, here's my applicationContext.xml:

<?xml version="1.0" encoding="UTF-8"?>
	<!--  ActiveMQ destinations to use  -->
	<bean id="destination" class="org.apache.activemq.command.ActiveMQQueue" autowire="constructor">
		<constructor-arg value="NEW" />

	<bean id="jmsFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
		<property name="brokerURL">
		<property name="redeliveryPolicy">
			<ref local="redeliveryPolicy" />
	<bean id="redeliveryPolicy" class="org.apache.activemq.RedeliveryPolicy">
		<property name="initialRedeliveryDelay" value="10000" />
		<property name="maximumRedeliveries" value="4" />
		<property name="useExponentialBackOff" value="true" />
		<property name="backOffMultiplier" value="2" />
	<!-- Spring JMS Template -->
	<bean id="myJmsTemplate" 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 local="jmsFactory" />
	<bean id="consumerJmsTemplate" class="org.springframework.jms.core.JmsTemplate">
		<property name="connectionFactory" ref="jmsFactory"/>

	<!-- and this is the message listener container -->
	<bean id="jmsContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
		<property name="connectionFactory" ref="jmsFactory"/>
		<property name="destination" ref="destination"/>
		<property name="messageListener" ref="messageListener" />
		<property name="concurrentConsumers" value="100" />
		<property name="maxMessagesPerTask" value="1" />
		<property name="sessionTransacted" value="true" />		
	<!-- this is the Message Driven POJO (MDP) -->
	<bean id="messageListener" class="com.globolog.asserver.jms.Consumer" />	

The messageListener will create a RuntimeException on the onMessage method to produce an error.
The first redelivery attempt occurs immediately, without respect to the initialRedeliveryDelay.

> Redelivery on a failure doesn't respect the initialRedeliveryDelay on the first attempt.
> ----------------------------------------------------------------------------------------
>                 Key: AMQ-1847
>                 URL:
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker
>    Affects Versions: 5.1.0
>         Environment: Linux, ActiveMQ 5.1, Spring 2.5.x with transacted DefaultMessageListenerContainer
>            Reporter: Veit Guna
> Hi.
> I'm using ActiveMQ 5.1 together with Spring's DefaultMessageListenerContainer to enable
MDPs. I'm using the redeliveryPolicy to enable redelivery on failures during consumption of
a message. ActiveMQ configuration looks like this:
>     <camelContext id="camel" xmlns="">
>         <route errorHandlerRef="deadLetterErrorHandler">
>                 <from uri="activemq:NEW" />
>         </route>
>     </camelContext>
> <bean id="deadLetterErrorHandler" class="org.apache.camel.builder.DeadLetterChannelBuilder">
>     <property name="redeliveryPolicy" ref="redeliveryPolicyConfig"/>
> </bean>
> <bean id="redeliveryPolicyConfig" class="org.apache.camel.processor.RedeliveryPolicy">
>     <property name="maximumRedeliveries" value="4"/>
>     <property name="initialRedeliveryDelay" value="30000"/>
>     <property name="useExponentialBackOff" value="true"/>
>     <property name="backOffMultiplier" value="2" />
> </bean>
> Now if a failure occurs, the configured delay isn't used on the first redelivery attempt.
Instead redelivery takes place immediately after the failure occured. This sounds odd to me,
since the property is even called initialRedeliveryDelay :). I know that maybe this was caused
due to the following issue:
> In my opinion immediately redelivery isn't very useful in most cases. If a failure occurs,
it won't be fixed some ms later :). So my suggestion is (in respect to AMQ-1032) to have two
> initialRedeliveryDelay
> redeliveryDelay
> So both configurations would be possible. For AMQ-1032 just configure initialRedeliveryDelay
to 0. Otherwise just take the redeliveryDelay as initialRedeliveryDelay to get what I want
> Does this make sense?

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message