You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Nilantha <Ni...@autodata.net> on 2007/02/02 19:48:23 UTC

Testing "maximumRedeliveries"... MDP does not receives messages once an Exception is thrown...

I have posted this message earlier but it seems lost... sorry if I make
duplicates. 

I am using Jencks(2.0) for inbound. I am throwing a Runtime exception in
order to test max redelivery setting (I couldn't find any better way to test
with MDPs). If there are no exceptions thrown from MDP messages are consumed
continuously. But as soon as an exception is thrown MDP no longer receives
messages. Only way to get those consumed is restart the app with consumers
again and again. Each time I see rediliveryCount has been increased by 1 for
any message remained the queue. 

This is how I have configured "maximumRedeliveries" 

  <bean id="activeMQResourceAdapter"
class="org.apache.activemq.ra.ActiveMQResourceAdapter"> 
    <property name="serverUrl" value="tcp://192.121.139.110:61416"/> 
    <property name="initialRedeliveryDelay"><value>2000</value></property> 
        <property name="maximumRedeliveries"><value>3</value></property> 
        <property
name="redeliveryBackOffMultiplier"><value>2</value></property> 
        <property
name="redeliveryUseExponentialBackOff"><value>true</value></property> 
        <property name="allPrefetchValues"><value>1</value></property> 
  </bean> 

  <bean id="jencks" class="org.jencks.JCAContainer"> 
  <property name="bootstrapContext"> 
        <bean class="org.jencks.factory.BootstrapContextFactoryBean"> 
          <property name="transactionManager" ref="transactionManager"/> 
          <property name="threadPoolSize" value="25"/> 
        </bean> 
        </property> 
    <property name="resourceAdapter" ref="activeMQResourceAdapter" /> 
  </bean> 

Am I missing anything here(using activemq-4.1.0)? Thank you in advance for
any idea on this. 

-Nilantha 

-- 
View this message in context: http://www.nabble.com/Testing-%22maximumRedeliveries%22...-MDP-does-not-receives-messages-once-an-Exception-is-thrown...-tf3162722.html#a8772945
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Testing "maximumRedeliveries"... MDP does not receives messages once an Exception is thrown...

Posted by Nilantha <Ni...@autodata.net>.

Nilantha Jayalath wrote:
> 
> 
> Thanks Christopher I did as you suggested but still the consumer stop
> receiving after the first exception. Only way to get those remaining
> messages consumed is restart the app with consumers again and again. Each
> time I see rediliveryCount has been increased by 1 for any message
> remained the queue.
> 
> this is the last log statement I see
> ServerSessionImpl:0 pool-1-thread-2 - Endpoint failed to process message.
> Reason: java.lang.RuntimeException: Endpoint after delivery notification
> failure
> 
> this is my configuration... I am missing anything else here?
> 
>   <bean id="transactionManager"
> class="org.jencks.factory.TransactionManagerFactoryBean"/>
> 
>   <bean id="connectionManager"
> class="org.jencks.factory.ConnectionManagerFactoryBean">
>     <property name="transactionManager" ref="transactionManager"/>
>   </bean>
> 
>   <bean id="jmsManagedConnectionFactory"
> class="org.apache.activemq.ra.ActiveMQManagedConnectionFactory">
>     <property name="resourceAdapter" ref="activeMQResourceAdapter"/>
>   </bean>
> 
>   <bean id="jmsConnectionFactory"
> class="org.jencks.factory.ConnectionFactoryFactoryBean">
>     <property name="managedConnectionFactory"
> ref="jmsManagedConnectionFactory"/>
>     <property name="connectionManager" ref="connectionManager"/>
>   </bean>
> 
>   <bean id="MyQueue" class="org.apache.activemq.command.ActiveMQQueue">
> 		<constructor-arg index="0" value="net.xxx.PostQueue" />
>   </bean>
> 	
>   <!--
>   || Jencks JCA Container
>   -->
>   <bean id="jencks" class="org.jencks.JCAContainer">
>     <property name="transactionManager" ref="transactionManager"/>
>     <property name="threadPoolSize" value="150"/>
>     <property name="resourceAdapter" ref="activeMQResourceAdapter" />
>   </bean>
>   <bean id="activeMQResourceAdapter"
> class="org.apache.activemq.ra.ActiveMQResourceAdapter">
>    	<property name="serverUrl"
> 		
> value="tcp://xxx:61416?jms.redeliveryPolicy.allPrefetchValues=1&amp;jms.redeliveryPolicy.initialRedeliveryDelay=2000&amp;jms.redeliveryPolicy.maximumRedeliveries=4&amp;jms.redeliveryPolicy.useCollisionAvoidance=true"
> />
>   </bean>
> 
>   <!--
>     || an inbound message connector using a stateful, pooled 
> MessageListener
>     -->
>   <bean id="inboundConnectorB" class="org.jencks.JCAConnector">
> 
>     <property name="jcaContainer" ref="jencks"/>
> 
>     <!-- subscription details -->
>     <property name="activationSpec">
>       <bean class="org.apache.activemq.ra.ActiveMQActivationSpec">
>         <property name="destination" value=" MyQueue"/>
>         <property name="destinationType" value="javax.jms.Queue"/>
>       </bean>
>     </property>
> 
>     <!-- This example uses a non pooled bean -->
>     <property name="ref" value="echoBean"/>
>   </bean>
> 
> 


Christopher G. Stach II wrote:
> 
> Nilantha wrote:
>> 
>> Nilantha wrote:
>>> I did the change as suggested(had to replace '&' with ';')
>>>
>>> <property name="serverUrl"
>>> 		
>>> value="failover:(tcp://xxx:61416,tcp://xxx:61417)?jms.redeliveryPolicy.allPrefetchValues=1;jms.redeliveryPolicy.initialRedeliveryDelay=2000;jms.redeliveryPolicy.maximumRedeliveries=4;jms.redeliveryPolicy.useCollisionAvoidance=true;"
>>> />
>>>
>>> now I am getting following NPE from ConnectionStateTracker as soon as an
>>> exception is thrown.
>>>
> 
> I don't think that's going to be a valid URL with semicolons.  Maybe
> &amp; instead of &?
> 
> -- 
> Christopher G. Stach II
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Testing-%22maximumRedeliveries%22...-MDP-does-not-receives-messages-once-an-Exception-is-thrown...-tf3162722.html#a8807375
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Testing "maximumRedeliveries"... MDP does not receives messages once an Exception is thrown...

Posted by "Christopher G. Stach II" <cg...@ldsys.net>.
Nilantha wrote:
> 
> Nilantha wrote:
>> I did the change as suggested(had to replace '&' with ';')
>>
>> <property name="serverUrl"
>> 		
>> value="failover:(tcp://xxx:61416,tcp://xxx:61417)?jms.redeliveryPolicy.allPrefetchValues=1;jms.redeliveryPolicy.initialRedeliveryDelay=2000;jms.redeliveryPolicy.maximumRedeliveries=4;jms.redeliveryPolicy.useCollisionAvoidance=true;"
>> />
>>
>> now I am getting following NPE from ConnectionStateTracker as soon as an
>> exception is thrown.
>>

I don't think that's going to be a valid URL with semicolons.  Maybe
&amp; instead of &?

-- 
Christopher G. Stach II


Re: Testing "maximumRedeliveries"... MDP does not receives messages once an Exception is thrown...

Posted by Nilantha <Ni...@autodata.net>.

Nilantha wrote:
> 
> I did the change as suggested(had to replace '&' with ';')
> 
> <property name="serverUrl"
> 		
> value="failover:(tcp://xxx:61416,tcp://xxx:61417)?jms.redeliveryPolicy.allPrefetchValues=1;jms.redeliveryPolicy.initialRedeliveryDelay=2000;jms.redeliveryPolicy.maximumRedeliveries=4;jms.redeliveryPolicy.useCollisionAvoidance=true;"
> />
> 
> now I am getting following NPE from ConnectionStateTracker as soon as an
> exception is thrown.
> 
> java.lang.RuntimeException: manually thrown exception: id15
> 	at net.xxx.xxx.jms.TestBean.onMessage(TestBean.java:34)
> 	at
> org.jencks.LocalTransactionEndpoint.onMessage(LocalTransactionEndpoint.java:68)
> 	at
> org.apache.activemq.ra.MessageEndpointProxy$MessageEndpointAlive.onMessage(MessageEndpointProxy.java:121)
> 	at
> org.apache.activemq.ra.MessageEndpointProxy.onMessage(MessageEndpointProxy.java:61)
> 	at org.apache.activemq.ActiveMQSession.run(ActiveMQSession.java:695)
> 	at
> org.apache.activemq.ra.ServerSessionImpl.run(ServerSessionImpl.java:165)
> 	at
> org.apache.geronimo.connector.work.WorkerContext.run(WorkerContext.java:290)
> 	at
> org.apache.geronimo.connector.work.pool.NamedRunnable.run(NamedRunnable.java:32)
> 	at
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
> 	at
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
> 	at java.lang.Thread.run(Thread.java:595)
> Exception in thread "ActiveMQ Transport: tcp:///XXXX:61416"
> java.lang.NullPointerException
> 	at
> org.apache.activemq.state.ConnectionStateTracker$RemoveTransactionAction.run(ConnectionStateTracker.java:77)
> 	at org.apache.activemq.state.Tracked.onResponses(Tracked.java:32)
> 	at
> org.apache.activemq.transport.failover.FailoverTransport$1.onCommand(FailoverTransport.java:96)
> 	at
> org.apache.activemq.transport.WireFormatNegotiator.onCommand(WireFormatNegotiator.java:133)
> 	at
> org.apache.activemq.transport.InactivityMonitor.onCommand(InactivityMonitor.java:122)
> 	at
> org.apache.activemq.transport.TransportSupport.doConsume(TransportSupport.java:84)
> 	at
> org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:137)
> 	at java.lang.Thread.run(Thread.java:595)
> 
>  consumer working fine when no manual exception case...any idea what I
> went wrong here?
> 
> -Nilantha
> 


Christopher G. Stach II wrote:
> 
> Nilantha wrote:
>> I have posted this message earlier but it seems lost... sorry if I make
>> duplicates. 
>> 
>> I am using Jencks(2.0) for inbound. I am throwing a Runtime exception in
>> order to test max redelivery setting (I couldn't find any better way to
>> test
>> with MDPs). If there are no exceptions thrown from MDP messages are
>> consumed
>> continuously. But as soon as an exception is thrown MDP no longer
>> receives
>> messages. Only way to get those consumed is restart the app with
>> consumers
>> again and again. Each time I see rediliveryCount has been increased by 1
>> for
>> any message remained the queue. 
>> 
>> This is how I have configured "maximumRedeliveries" 
>> 
>>   <bean id="activeMQResourceAdapter"
>> class="org.apache.activemq.ra.ActiveMQResourceAdapter"> 
>>     <property name="serverUrl" value="tcp://192.121.139.110:61416"/> 
>>     <property
>> name="initialRedeliveryDelay"><value>2000</value></property> 
>>         <property name="maximumRedeliveries"><value>3</value></property> 
>>         <property
>> name="redeliveryBackOffMultiplier"><value>2</value></property> 
>>         <property
>> name="redeliveryUseExponentialBackOff"><value>true</value></property> 
>>         <property name="allPrefetchValues"><value>1</value></property> 
>>   </bean> 
>> 
> 
> Try just configuring it on the URL for your RA.  This is what I use:
> 
> failover:(tcp://mq1.xxx:49995,tcp://mq2.xxx:49995)?jms.redeliveryPolicy.allPrefetchValues=1&jms.redeliveryPolicy.initialRedeliveryDelay=2000&jms.redeliveryPolicy.maximumRedeliveries=24&jms.redeliveryPolicy.useCollisionAvoidance=true
> 
> I used to configure it with the bean properties and it worked, but this
> was better for my project setup.
> 
> -- 
> Christopher G. Stach II
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Testing-%22maximumRedeliveries%22...-MDP-does-not-receives-messages-once-an-Exception-is-thrown...-tf3162722.html#a8774735
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Testing "maximumRedeliveries"... MDP does not receives messages once an Exception is thrown...

Posted by "Christopher G. Stach II" <cg...@ldsys.net>.
Nilantha wrote:
> I have posted this message earlier but it seems lost... sorry if I make
> duplicates. 
> 
> I am using Jencks(2.0) for inbound. I am throwing a Runtime exception in
> order to test max redelivery setting (I couldn't find any better way to test
> with MDPs). If there are no exceptions thrown from MDP messages are consumed
> continuously. But as soon as an exception is thrown MDP no longer receives
> messages. Only way to get those consumed is restart the app with consumers
> again and again. Each time I see rediliveryCount has been increased by 1 for
> any message remained the queue. 
> 
> This is how I have configured "maximumRedeliveries" 
> 
>   <bean id="activeMQResourceAdapter"
> class="org.apache.activemq.ra.ActiveMQResourceAdapter"> 
>     <property name="serverUrl" value="tcp://192.121.139.110:61416"/> 
>     <property name="initialRedeliveryDelay"><value>2000</value></property> 
>         <property name="maximumRedeliveries"><value>3</value></property> 
>         <property
> name="redeliveryBackOffMultiplier"><value>2</value></property> 
>         <property
> name="redeliveryUseExponentialBackOff"><value>true</value></property> 
>         <property name="allPrefetchValues"><value>1</value></property> 
>   </bean> 
> 

Try just configuring it on the URL for your RA.  This is what I use:

failover:(tcp://mq1.xxx:49995,tcp://mq2.xxx:49995)?jms.redeliveryPolicy.allPrefetchValues=1&jms.redeliveryPolicy.initialRedeliveryDelay=2000&jms.redeliveryPolicy.maximumRedeliveries=24&jms.redeliveryPolicy.useCollisionAvoidance=true

I used to configure it with the bean properties and it worked, but this
was better for my project setup.

-- 
Christopher G. Stach II