Quantcast

initialRedeliveryDelay and redeliveryDelay Not Working - ActiveMQ 5.14.2 + Spring

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

initialRedeliveryDelay and redeliveryDelay Not Working - ActiveMQ 5.14.2 + Spring

Fernando Franzini
This post was updated on .
Hello people

I started using ActiveMQ and the initialRedeliveryDelay and redeliveryDelay properties of the policy did not work! Both assume 1 second .... maximumRedeliveries is working! I searched the solution for many days and did not find it. Can anybody help me?
Here's my settings:

pom:
        <dependencies>
               
                <dependency>
                        <groupId>org.codehaus.groovy</groupId>
                        <artifactId>groovy-all</artifactId>
                        <version>2.4.0</version>
                </dependency>
               
                <dependency>
                        <groupId>log4j</groupId>
                        <artifactId>log4j</artifactId>
                        <version>1.2.17</version>
                </dependency>
               
                <dependency>
                        <groupId>org.springframework</groupId>
                        <artifactId>spring-context</artifactId>
                        <version>${spring.version}</version>
                </dependency>
                <dependency>
                        <groupId>org.springframework</groupId>
                        <artifactId>spring-jms</artifactId>
                        <version>${spring.version}</version>
                </dependency>
               
                <dependency>
                        <groupId>org.apache.activemq</groupId>
                        <artifactId>activemq-all</artifactId>
                        <version>5.14.2</version>
                </dependency>
               
                <dependency>
                        <groupId>javax.enterprise</groupId>
                        <artifactId>cdi-api</artifactId>
                        <version>1.1</version>
                </dependency>
        </dependencies>

spring:

        <bean id="localBroker" class="org.apache.activemq.broker.BrokerService" init-method="start"
                destroy-method="stop">
                <property name="brokerName" value="localhost" />
                <property name="persistent" value="false" />
                <property name="useJmx" value="false" />
        </bean>

        <bean id="politica" class="org.apache.activemq.RedeliveryPolicy">
                <property name="initialRedeliveryDelay" value="10000" />
                <property name="redeliveryDelay" value="10000" />
                <property name="maximumRedeliveries" value="3" />
        </bean>

        <bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
                <constructor-arg value="vm://localhost?create=false" />
                <property name="redeliveryPolicy" ref="politica" />
        </bean>

        <bean id="jmsTransactionManager" class="org.springframework.jms.connection.JmsTransactionManager">
                <property name="connectionFactory" ref="connectionFactory" />
        </bean>

        <bean id="cacheConnectionFactory" class="org.springframework.jms.connection.CachingConnectionFactory">
                <constructor-arg ref="connectionFactory" />
                <property name="sessionCacheSize" value="5" />
        </bean>

        <bean id="fila1" class="org.apache.activemq.command.ActiveMQQueue">
                <constructor-arg value="fila1" />
        </bean>

        <bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
                <property name="connectionFactory" ref="cacheConnectionFactory" />
                <property name="defaultDestination" ref="fila1" />
                <property name="sessionTransacted" value="true" />
        </bean>

        <bean id="listenerMensagem" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
                <property name="connectionFactory" ref="cacheConnectionFactory" />
                <property name="destination" ref="fila1" />
                <property name="messageListener" ref="receptor" />
                <property name="transactionManager" ref="jmsTransactionManager" />
        </bean>

        <context:component-scan base-package="mensageria" />

Is there something wrong? What do I have to do to set my initialRedeliveryDelay time and redeliveryDelay?
Best Regards
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: initialRedeliveryDelay and redeliveryDelay Not Working - ActiveMQ 5.14.2 + Spring

Fernando Franzini
This post was updated on .
I discovered the problem:

The constructor, I don know how is overriding my setup:
<constructor-arg value="vm://localhost?create=false" />

I simply stopped using ... and use the property to give the broker's URL:
<bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory" depends-on="localBroker">
<property name="brokerURL" value="vm://localhost?create=false" />
After that, all my retry policy settings worked ...

Best Regards!
Loading...