ActiveMQ
  1. ActiveMQ
  2. AMQ-3285

ActiveMQXAConnectionFactory does not respect various parameters for redelivery policy

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Not a Problem
    • Affects Version/s: 5.4.0, 5.4.2, 5.5.0
    • Fix Version/s: None
    • Component/s: JMS client
    • Labels:
      None
    • Regression:
      Unit Test Broken

      Description

      I tried to add these following parameters to my redelivery policy and activeMQ is not respecting any of them except maximumRedelivery
      <spring:bean id="redeliveryPolicy" class="org.apache.activemq.RedeliveryPolicy">
      <spring:property name="maximumRedeliveries" value="5"/>
      <spring:property name="initialRedeliveryDelay" value="5000"/>
      <spring:property name="redeliveryDelay" value="2000"/>
      <spring:property name="useExponentialBackOff" value="true"/>
      <spring:property name="backOffMultiplier" value="2"/>

      </spring:bean>

      I have attached the project which I took from https://issues.apache.org/jira/browse/AMQ-1593 and added the above parameter to my brokerURL:
      tcp://localhost:5000?jms.redeliveryPolicy.maximumRedeliveries=3&jms.redeliveryPolicy.initialRedeliveryDelay=10000&jms.redeliveryPolicy.deliveryDelay=10000&jms.redeliveryPolicy.useExponentialBackOff=true&jms.redeliveryPolicy.backOffMultiplier=2

      This test case will show you that none of the parameters like initiaRedeliveryDelay etc will take effect, except maxRedeliveries

      1. activemq-test.zip
        13 kB
        Jaskirat Bhatia
      2. activemq-test-0.1-project.zip
        12 kB
        Alberto Aresca

        Issue Links

          Activity

          Hide
          Timothy Bish added a comment -

          Recommend you try and modify the test case /activemq-core/src/test/java/org/apache/activemq/ActiveMQXAConnectionFactoryTest.java to show your issue and open a new Jira ticket to track its progress.

          Show
          Timothy Bish added a comment - Recommend you try and modify the test case /activemq-core/src/test/java/org/apache/activemq/ActiveMQXAConnectionFactoryTest.java to show your issue and open a new Jira ticket to track its progress.
          Hide
          Alberto Aresca added a comment -

          Unfortunately I can't attach anything to the case (i guess because the case has been closed), but it can be easily reproduced by simply replacing the jms.redeliveryPolicy.deliveryDelay in the test-context.xml file to jms.redeliveryPolicy.redeliveryDelay.

          Show
          Alberto Aresca added a comment - Unfortunately I can't attach anything to the case (i guess because the case has been closed), but it can be easily reproduced by simply replacing the jms.redeliveryPolicy.deliveryDelay in the test-context.xml file to jms.redeliveryPolicy.redeliveryDelay.
          Hide
          Alberto Aresca added a comment -

          I've used the same test replacing deliveryDelay with redeliveryDelay but i'm still experiencing the same behavior and I'm under the impression that whatever value I set there won't simply be taken in account by the XA Redelivery policy.

          I've attached a new version of the testcase.

          Show
          Alberto Aresca added a comment - I've used the same test replacing deliveryDelay with redeliveryDelay but i'm still experiencing the same behavior and I'm under the impression that whatever value I set there won't simply be taken in account by the XA Redelivery policy. I've attached a new version of the testcase.
          Hide
          Timothy Bish added a comment -

          You are welcome to create a JUnit test case that shows your issue and attach it here for review.

          Show
          Timothy Bish added a comment - You are welcome to create a JUnit test case that shows your issue and attach it here for review.
          Hide
          Alberto Aresca added a comment -

          Hello Timothy, I've just run the ast version of the test case you attached but I don't see any delay between redeliveries:

          2012-08-17 11:16:59,897 [queueListenerPojo-1] WARN  org.springframework.jms.listener.DefaultMessageListenerContainer  - Execution of JMS message listener failed, and no ErrorHandler has been set.
          java.lang.IllegalStateException: an exception
          	at test.LoggingMessageListener.onMessage(LoggingMessageListener.java:22)
          	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
          	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          	at java.lang.reflect.Method.invoke(Method.java:597)
          	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
          	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
          	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
          	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
          	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
          	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
          	at $Proxy13.onMessage(Unknown Source)
          	at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:560)
          	at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:498)
          	at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:467)
          	at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:325)
          	at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:243)
          	at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1058)
          	at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1050)
          	at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:947)
          	at java.lang.Thread.run(Thread.java:680)
          2012-08-17 11:16:59,902 [queueListenerPojo-1] INFO  test.LoggingMessageListener  - received: ActiveMQTextMessage {commandId = 10, responseRequired = false, messageId = ID:MacBook-Pro-de-Alberto-Aresca-2.local-65429-1345213018686-2:1:2:1:1, originalDestination = null, originalTransactionId = null, producerId = ID:MacBook-Pro-de-Alberto-Aresca-2.local-65429-1345213018686-2:1:2:1, destination = queue://myQueue, transactionId = XID:1114926712:737072696e672d62746d0000013934f1b46700000001:737072696e672d62746d0000013934f1b48b00000004, expiration = 0, timestamp = 1345213019275, arrival = 0, brokerInTime = 1345213019327, brokerOutTime = 1345213019901, correlationId = null, replyTo = null, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = null, marshalledProperties = null, dataStructure = null, redeliveryCounter = 10, size = 0, properties = null, readOnlyProperties = true, readOnlyBody = true, droppable = false, text = text message}
          2012-08-17 11:16:59,903 [queueListenerPojo-1] WARN  org.springframework.jms.listener.DefaultMessageListenerContainer  - Execution of JMS message listener failed, and no ErrorHandler has been set.
          java.lang.IllegalStateException: an exception
          	at test.LoggingMessageListener.onMessage(LoggingMessageListener.java:22)
          	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
          	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          	at java.lang.reflect.Method.invoke(Method.java:597)
          	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
          	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
          	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
          	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
          	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
          	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
          	at $Proxy13.onMessage(Unknown Source)
          	at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:560)
          	at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:498)
          	at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:467)
          	at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:325)
          	at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:243)
          	at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1058)
          	at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1050)
          	at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:947)
          	at java.lang.Thread.run(Thread.java:680)
          

          As you can se from the log of my last 2 redeliveries the wait is of about 10 ms while it should be 10s*2*$(last_redelivery_timeout}

          Am I missing something?

          Show
          Alberto Aresca added a comment - Hello Timothy, I've just run the ast version of the test case you attached but I don't see any delay between redeliveries: 2012-08-17 11:16:59,897 [queueListenerPojo-1] WARN org.springframework.jms.listener.DefaultMessageListenerContainer - Execution of JMS message listener failed, and no ErrorHandler has been set. java.lang.IllegalStateException: an exception at test.LoggingMessageListener.onMessage(LoggingMessageListener.java:22) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) at $Proxy13.onMessage(Unknown Source) at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:560) at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:498) at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:467) at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:325) at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:243) at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1058) at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1050) at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:947) at java.lang. Thread .run( Thread .java:680) 2012-08-17 11:16:59,902 [queueListenerPojo-1] INFO test.LoggingMessageListener - received: ActiveMQTextMessage {commandId = 10, responseRequired = false , messageId = ID:MacBook-Pro-de-Alberto-Aresca-2.local-65429-1345213018686-2:1:2:1:1, originalDestination = null , originalTransactionId = null , producerId = ID:MacBook-Pro-de-Alberto-Aresca-2.local-65429-1345213018686-2:1:2:1, destination = queue: //myQueue, transactionId = XID:1114926712:737072696e672d62746d0000013934f1b46700000001:737072696e672d62746d0000013934f1b48b00000004, expiration = 0, timestamp = 1345213019275, arrival = 0, brokerInTime = 1345213019327, brokerOutTime = 1345213019901, correlationId = null , replyTo = null , persistent = true , type = null , priority = 4, groupID = null , groupSequence = 0, targetConsumerId = null , compressed = false , userID = null , content = null , marshalledProperties = null , dataStructure = null , redeliveryCounter = 10, size = 0, properties = null , readOnlyProperties = true , readOnlyBody = true , droppable = false , text = text message} 2012-08-17 11:16:59,903 [queueListenerPojo-1] WARN org.springframework.jms.listener.DefaultMessageListenerContainer - Execution of JMS message listener failed, and no ErrorHandler has been set. java.lang.IllegalStateException: an exception at test.LoggingMessageListener.onMessage(LoggingMessageListener.java:22) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) at $Proxy13.onMessage(Unknown Source) at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:560) at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:498) at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:467) at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:325) at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:243) at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1058) at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1050) at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:947) at java.lang. Thread .run( Thread .java:680) As you can se from the log of my last 2 redeliveries the wait is of about 10 ms while it should be 10s*2*$(last_redelivery_timeout} Am I missing something?
          Hide
          Timothy Bish added a comment -

          Added to unit test for the /activemq-core/src/test/java/org/apache/activemq/ActiveMQXAConnectionFactoryTest.java to show options are set as supplied on the URI.

          Show
          Timothy Bish added a comment - Added to unit test for the /activemq-core/src/test/java/org/apache/activemq/ActiveMQXAConnectionFactoryTest.java to show options are set as supplied on the URI.
          Hide
          Timothy Bish added a comment -

          Added to /activemq-core/src/test/java/org/apache/activemq/ActiveMQXAConnectionFactoryTest.java to show that there is no issue on client. The test case has an incorrect option 'deliveryDelay' which should be 'redeliveryDelay'

          Show
          Timothy Bish added a comment - Added to /activemq-core/src/test/java/org/apache/activemq/ActiveMQXAConnectionFactoryTest.java to show that there is no issue on client. The test case has an incorrect option 'deliveryDelay' which should be 'redeliveryDelay'
          Hide
          Alex Ooi added a comment -

          Hello,

          Did this get resolved?!

          We are using ActiveMQ 5.5.1 (second latest.. I see that 5.6.0 is available) and am seeing this exact issue. The redeliveryDelay in the latest comment is set correctly, but the message is getting picked up immediately by the Listener...

          Thus, our configurations for redelivery are not being respected.

          Is there any intention to fix this? We are not using the persistent mechanism of ActiveMQ. Haven't tried with persistence, but this is not ideal for our scenario anyway. We want to keep messages non-persistent, but also want the redelivery to occur when a transaction is rolled back and respect the redelivery configuration so that we dont use up all of our redeliveries in such a short space of time.

          Show
          Alex Ooi added a comment - Hello, Did this get resolved?! We are using ActiveMQ 5.5.1 (second latest.. I see that 5.6.0 is available) and am seeing this exact issue. The redeliveryDelay in the latest comment is set correctly, but the message is getting picked up immediately by the Listener... Thus, our configurations for redelivery are not being respected. Is there any intention to fix this? We are not using the persistent mechanism of ActiveMQ. Haven't tried with persistence, but this is not ideal for our scenario anyway. We want to keep messages non-persistent, but also want the redelivery to occur when a transaction is rolled back and respect the redelivery configuration so that we dont use up all of our redeliveries in such a short space of time.
          Hide
          John Baker added a comment - - edited

          Hello,

          I've got some information to add. I've debugged this and find the following code being (correctly?) executed in ActiveMQMessageConsumer when a message is rolled back:

                              if (redeliveryDelay > 0 && !unconsumedMessages.isClosed()) {
                                  // Start up the delivery again a little later.
                                  scheduler.executeAfterDelay(new Runnable() {
                                      public void run() {
                                          try {
                                              if (started.get()) {
                                                  start();
                                              }
                                          } catch (JMSException e) {
                                              session.connection.onAsyncException(e);
                                          }
                                      }
                                  }, redeliveryDelay);
          

          The value of redeliveryDelay (in ms) is correct. However, the "problem" is the Spring DefaultMessageListener, which asks ActiveMQ for another message and it gives back the message waiting for redelivery. I can see that the thread has the same ID in the debugger, so I think the problem is better described as:

          "ActiveMQ does not remove the message due for redelivery from the queue, but gives it out next time it's asked to do so. After X retries, it's moved to the DLQ and hence the listener will not receive it again when it asks for the next message".

          This is a very serious problem.

          J

          Show
          John Baker added a comment - - edited Hello, I've got some information to add. I've debugged this and find the following code being (correctly?) executed in ActiveMQMessageConsumer when a message is rolled back: if (redeliveryDelay > 0 && !unconsumedMessages.isClosed()) { // Start up the delivery again a little later. scheduler.executeAfterDelay( new Runnable () { public void run() { try { if (started.get()) { start(); } } catch (JMSException e) { session.connection.onAsyncException(e); } } }, redeliveryDelay); The value of redeliveryDelay (in ms) is correct. However, the "problem" is the Spring DefaultMessageListener, which asks ActiveMQ for another message and it gives back the message waiting for redelivery. I can see that the thread has the same ID in the debugger, so I think the problem is better described as: "ActiveMQ does not remove the message due for redelivery from the queue, but gives it out next time it's asked to do so. After X retries, it's moved to the DLQ and hence the listener will not receive it again when it asks for the next message". This is a very serious problem. J
          Hide
          Alberto Aresca added a comment -

          Thanks Jas, please find attached the new test case

          Show
          Alberto Aresca added a comment - Thanks Jas, please find attached the new test case
          Hide
          Jaskirat Bhatia added a comment -

          Based on alberto's comment I will reopen this bug

          Show
          Jaskirat Bhatia added a comment - Based on alberto's comment I will reopen this bug
          Hide
          Jaskirat Bhatia added a comment -

          Hi Alberto
          leme try to reopen the case. I never followed on this case, but I am sure there is a problem.

          Show
          Jaskirat Bhatia added a comment - Hi Alberto leme try to reopen the case. I never followed on this case, but I am sure there is a problem.
          Hide
          Alberto Aresca added a comment -

          Ok I realized I can't attach anything being the case close so I will only post the modification I made:

          • Changed the brockerURL properties from the bean queueConnectionFactory to
            <prop key="brokerURL" >tcp://localhost:61616?jms.redeliveryPolicy.maximumRedeliveries=10%26jms.redeliveryPolicy.initialRedeliveryDelay=10000%26jms.redeliveryPolicy.deliveryDelay=10000%26jms.redeliveryPolicy.useExponentialBackOff=true%26jms.redeliveryPolicy.backOffMultiplier=2</prop>
            
          • Replaced the pom with the following one
            <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
            	<modelVersion>4.0.0</modelVersion>
            	<groupId>test</groupId>
            	<artifactId>activemq-test</artifactId>
            	<packaging>jar</packaging>
            	<name>activemq-xaconnection-factory-test</name>
            	<version>0.1</version>
            	<url></url>
            
            	<properties>
            		<slf4j.version>1.6.1</slf4j.version>
            		<spring.version>3.0.6.RELEASE</spring.version>
            	</properties>
            
            	<dependencies>
            		<dependency>
            			<groupId>org.apache.geronimo.specs</groupId>
            			<artifactId>geronimo-jms_1.1_spec</artifactId>
            			<version>1.0</version>
            		</dependency>
            		<dependency>
            			<groupId>org.apache.geronimo.specs</groupId>
            			<artifactId>geronimo-jta_1.0.1B_spec</artifactId>
            			<version>1.1.1</version>
            		</dependency>
            		<dependency>
            			<groupId>junit</groupId>
            			<artifactId>junit</artifactId>
            			<version>4.9</version>
            			<scope>test</scope>
            		</dependency>
            
            		<dependency>
            			<groupId>org.springframework</groupId>
            			<artifactId>spring-core</artifactId>
            			<version>${spring.version}</version>
            		</dependency>
            		<dependency>
            			<groupId>org.springframework</groupId>
            			<artifactId>spring-aop</artifactId>
            			<version>${spring.version}</version>
            		</dependency>
            		<dependency>
            			<groupId>org.springframework</groupId>
            			<artifactId>spring-jdbc</artifactId>
            			<version>${spring.version}</version>
            		</dependency>
            		<dependency>
            			<groupId>org.springframework</groupId>
            			<artifactId>spring-context</artifactId>
            			<version>${spring.version}</version>
            		</dependency>
            		<dependency>
            			<groupId>org.springframework</groupId>
            			<artifactId>spring-beans</artifactId>
            			<version>${spring.version}</version>
            		</dependency>
            		<dependency>
            			<groupId>org.springframework</groupId>
            			<artifactId>spring-jms</artifactId>
            			<version>${spring.version}</version>
            		</dependency>
            		<dependency>
            			<groupId>org.slf4j</groupId>
            			<artifactId>slf4j-api</artifactId>
            			<version>${slf4j.version}</version>
            		</dependency>
            		<dependency>
            			<groupId>org.slf4j</groupId>
            			<artifactId>slf4j-log4j12</artifactId>
            			<version>${slf4j.version}</version>
            		</dependency>
            		<dependency>
            			<groupId>org.apache.activemq</groupId>
            			<artifactId>activemq-core</artifactId>
            			<version>5.5.1</version>
            		</dependency>
            		<dependency>
            			<groupId>org.codehaus.btm</groupId>
            			<artifactId>btm</artifactId>
            			<version>2.1.2</version>
            		</dependency>
            		<dependency>
            			<groupId>org.springframework</groupId>
            			<artifactId>spring-test</artifactId>
            			<version>${spring.version}</version>
            			<scope>test</scope>
            			<exclusions>
            				<exclusion>
            					<groupId>commons-logging</groupId>
            					<artifactId>commons-logging</artifactId>
            				</exclusion>
            			</exclusions>
            		</dependency>
            	</dependencies>
            
            	<build>
            		<plugins>
            			<plugin>
            				<groupId>org.apache.maven.plugins</groupId>
            				<artifactId>maven-compiler-plugin</artifactId>
            				<configuration>
            					<fork>true</fork>
            					<source>1.6</source>
            					<target>1.6</target>
            					<meminitial>128m</meminitial>
            					<maxmem>512m</maxmem>
            					<encoding>UTF-8</encoding>
            					<debug>true</debug>
            				</configuration>
            			</plugin>
            			<plugin>
            				<groupId>org.apache.maven.plugins</groupId>
            				<artifactId>maven-surefire-plugin</artifactId>
            				<configuration>
            					<forkMode>pertest</forkMode>
            				</configuration>
            			</plugin>
            			<plugin>
            				<artifactId>maven-assembly-plugin</artifactId>
            				<version>2.2.1</version>
            				<configuration>
            					<descriptorRefs>
            						<descriptorRef>project</descriptorRef>
            					</descriptorRefs>
            				</configuration>
            			</plugin>
            		</plugins>
            	</build>
            
            </project>
            
            

          Can the case be reopened?

          Thanks

          Show
          Alberto Aresca added a comment - Ok I realized I can't attach anything being the case close so I will only post the modification I made: Changed the brockerURL properties from the bean queueConnectionFactory to <prop key= "brokerURL" >tcp: //localhost:61616?jms.redeliveryPolicy.maximumRedeliveries=10%26jms.redeliveryPolicy.initialRedeliveryDelay=10000%26jms.redeliveryPolicy.deliveryDelay=10000%26jms.redeliveryPolicy.useExponentialBackOff= true %26jms.redeliveryPolicy.backOffMultiplier=2</prop> Replaced the pom with the following one <project xmlns= "http://maven.apache.org/POM/4.0.0" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation= "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" > <modelVersion> 4.0.0 </modelVersion> <groupId> test </groupId> <artifactId> activemq-test </artifactId> <packaging> jar </packaging> <name> activemq-xaconnection-factory-test </name> <version> 0.1 </version> <url> </url> <properties> <slf4j.version> 1.6.1 </slf4j.version> <spring.version> 3.0.6.RELEASE </spring.version> </properties> <dependencies> <dependency> <groupId> org.apache.geronimo.specs </groupId> <artifactId> geronimo-jms_1.1_spec </artifactId> <version> 1.0 </version> </dependency> <dependency> <groupId> org.apache.geronimo.specs </groupId> <artifactId> geronimo-jta_1.0.1B_spec </artifactId> <version> 1.1.1 </version> </dependency> <dependency> <groupId> junit </groupId> <artifactId> junit </artifactId> <version> 4.9 </version> <scope> test </scope> </dependency> <dependency> <groupId> org.springframework </groupId> <artifactId> spring-core </artifactId> <version> ${spring.version} </version> </dependency> <dependency> <groupId> org.springframework </groupId> <artifactId> spring-aop </artifactId> <version> ${spring.version} </version> </dependency> <dependency> <groupId> org.springframework </groupId> <artifactId> spring-jdbc </artifactId> <version> ${spring.version} </version> </dependency> <dependency> <groupId> org.springframework </groupId> <artifactId> spring-context </artifactId> <version> ${spring.version} </version> </dependency> <dependency> <groupId> org.springframework </groupId> <artifactId> spring-beans </artifactId> <version> ${spring.version} </version> </dependency> <dependency> <groupId> org.springframework </groupId> <artifactId> spring-jms </artifactId> <version> ${spring.version} </version> </dependency> <dependency> <groupId> org.slf4j </groupId> <artifactId> slf4j-api </artifactId> <version> ${slf4j.version} </version> </dependency> <dependency> <groupId> org.slf4j </groupId> <artifactId> slf4j-log4j12 </artifactId> <version> ${slf4j.version} </version> </dependency> <dependency> <groupId> org.apache.activemq </groupId> <artifactId> activemq-core </artifactId> <version> 5.5.1 </version> </dependency> <dependency> <groupId> org.codehaus.btm </groupId> <artifactId> btm </artifactId> <version> 2.1.2 </version> </dependency> <dependency> <groupId> org.springframework </groupId> <artifactId> spring-test </artifactId> <version> ${spring.version} </version> <scope> test </scope> <exclusions> <exclusion> <groupId> commons-logging </groupId> <artifactId> commons-logging </artifactId> </exclusion> </exclusions> </dependency> </dependencies> <build> <plugins> <plugin> <groupId> org.apache.maven.plugins </groupId> <artifactId> maven-compiler-plugin </artifactId> <configuration> <fork> true </fork> <source> 1.6 </source> <target> 1.6 </target> <meminitial> 128m </meminitial> <maxmem> 512m </maxmem> <encoding> UTF-8 </encoding> <debug> true </debug> </configuration> </plugin> <plugin> <groupId> org.apache.maven.plugins </groupId> <artifactId> maven-surefire-plugin </artifactId> <configuration> <forkMode> pertest </forkMode> </configuration> </plugin> <plugin> <artifactId> maven-assembly-plugin </artifactId> <version> 2.2.1 </version> <configuration> <descriptorRefs> <descriptorRef> project </descriptorRef> </descriptorRefs> </configuration> </plugin> </plugins> </build> </project> Can the case be reopened? Thanks
          Hide
          Alberto Aresca added a comment -

          Hi all,

          I've been experiencing the very same issue Jaskirat has been talking about. I took the liberty to clean up the test he uploaded to expose even better the problem.

          Basically now the brokerURL is configured properly (without using CDATA and escaping the & to %26 )and by debugging it I can se that the org.apache.activemq.RedeliveryPolicy is correctly configured. However some of the property I've set (especially the useExponentialBackOff related one)

          Please take a look at the new attached test

          Show
          Alberto Aresca added a comment - Hi all, I've been experiencing the very same issue Jaskirat has been talking about. I took the liberty to clean up the test he uploaded to expose even better the problem. Basically now the brokerURL is configured properly (without using CDATA and escaping the & to %26 )and by debugging it I can se that the org.apache.activemq.RedeliveryPolicy is correctly configured. However some of the property I've set (especially the useExponentialBackOff related one) Please take a look at the new attached test
          Hide
          Timothy Bish added a comment -

          This appears to be an issue of not properly using the correct escape values for the & character in the XML. If an issue still occurs please provide a JUnit test case the demonstrates as the ActiveMQXAConnectionFactory delegates the property configuration to the same ActiveMQConnectionFactory that is tested quite extensively in the existing unit tests.

          Show
          Timothy Bish added a comment - This appears to be an issue of not properly using the correct escape values for the & character in the XML. If an issue still occurs please provide a JUnit test case the demonstrates as the ActiveMQXAConnectionFactory delegates the property configuration to the same ActiveMQConnectionFactory that is tested quite extensively in the existing unit tests.
          Hide
          Jaskirat Bhatia added a comment -

          Something is weird, I was able to run this with persistent message before. But now it is not working anymore.
          Can someone help?

          Show
          Jaskirat Bhatia added a comment - Something is weird, I was able to run this with persistent message before. But now it is not working anymore. Can someone help?
          Hide
          Jaskirat Bhatia added a comment -

          Hi Jan, nope that is not an issue. This thing works if the produced message is set to persistent, if non-persistent then all other attributes defined in the policy are ignored.

          So now the question would be, how to make this thing work for non-persistent messages also?

          Thanks

          Show
          Jaskirat Bhatia added a comment - Hi Jan, nope that is not an issue. This thing works if the produced message is set to persistent, if non-persistent then all other attributes defined in the policy are ignored. So now the question would be, how to make this thing work for non-persistent messages also? Thanks
          Hide
          Jan Lievens added a comment -

          The problem lies with the fact that a PoolingConnectionFactory is used. When using the org.springframework.jms.connection.CachingConnectionFactory the various backoff-settings do take effect. This is most likely not fixable due to the fact that multiple ActiveMQMessageConsumers are created and destroyed when using the PoolingConnectionFactory while that is not the case with the CachingConnectionFactory. At least what I see is that the prolific creation and destruction of ActiveMQMessageConsumers in conjunction with the fact that this class is holding state (e.g. the redeliveryDelay property) between rollbacks tends to be contradictory.
          Maybe someone with a better understanding of ActiveMQMessageConsumer in relation with PoolingConnectionFactory can shed some light on this. At least there is a workaround.

          Show
          Jan Lievens added a comment - The problem lies with the fact that a PoolingConnectionFactory is used. When using the org.springframework.jms.connection.CachingConnectionFactory the various backoff-settings do take effect. This is most likely not fixable due to the fact that multiple ActiveMQMessageConsumers are created and destroyed when using the PoolingConnectionFactory while that is not the case with the CachingConnectionFactory. At least what I see is that the prolific creation and destruction of ActiveMQMessageConsumers in conjunction with the fact that this class is holding state (e.g. the redeliveryDelay property) between rollbacks tends to be contradictory. Maybe someone with a better understanding of ActiveMQMessageConsumer in relation with PoolingConnectionFactory can shed some light on this. At least there is a workaround.
          Hide
          Jaskirat Bhatia added a comment -

          Hi Gary
          I tried this and still not working:
          <prop key="brokerURL">tcp://localhost:5000?jms.redeliveryPolicy.maximumRedeliveries=3&jms.redeliveryPolicy.initialRedeliveryDelay=10000&jms.redeliveryPolicy.deliveryDelay=10000&jms.redeliveryPolicy.useExponentialBackOff=true&jms.redeliveryPolicy.backOffMultiplier=2</prop>

          Thanks
          Jaskirat

          Show
          Jaskirat Bhatia added a comment - Hi Gary I tried this and still not working: <prop key="brokerURL">tcp://localhost:5000?jms.redeliveryPolicy.maximumRedeliveries=3&jms.redeliveryPolicy.initialRedeliveryDelay=10000&jms.redeliveryPolicy.deliveryDelay=10000&jms.redeliveryPolicy.useExponentialBackOff=true&jms.redeliveryPolicy.backOffMultiplier=2</prop> Thanks Jaskirat
          Hide
          Gary Tully added a comment -

          not sure what the ![CDATA[ gives you or what the brokerURL string ends up as.

          In place of CDATA, try replacing the '&' with the entity '&' so that is validates.

          Show
          Gary Tully added a comment - not sure what the ![CDATA[ gives you or what the brokerURL string ends up as. In place of CDATA, try replacing the '&' with the entity '&' so that is validates.

            People

            • Assignee:
              Unassigned
              Reporter:
              Jaskirat Bhatia
            • Votes:
              3 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development