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 Jayalath <Ni...@autodata.net> on 2007/02/01 17:32:56 UTC

No effect on maximumRedeliveries setting

I am using Sprin's DefaultMessageListenerContainer to consume messages.
What I noticed was "maximumRedeliveries" setting is not effective for
some reason. It just keeps redelivering messages.

Following is my connectionFactory setting.

According to the ActiveMQ documentation it seems a "Poison ack" is not
being sent back to the broker letting him know that the message was
considered a poison pill.

 

Am I missing anything here?

 

      <bean id="connectionFactory"
class="org.apache.activemq.pool.PooledConnectionFactory">

      <property name="connectionFactory">

            <bean class="org.apache.activemq.ActiveMQConnectionFactory">

            <property name="brokerURL" value="failover:(tcp://.....)" />

            <property name="redeliveryPolicy">

                  <bean class="org.apache.activemq.RedeliveryPolicy">

                        <property name="maximumRedeliveries" value="3"/>

                        <property name="backOffMultiplier" value="2"/>

                        <property name="initialRedeliveryDelay"
value="50"/>

                        <property name="useExponentialBackOff"
value="true"/>

                  </bean>

            </property>

            </bean>

      </property>

            <property name="maximumActive" value="8" />

      </bean>

 

Came across following

http://www.oreillynet.com/onjava/blog/2006/01/message_redelivery_and_dlq
_tip.html

Is this still valid for the AMQ 4.1.0 as well? Since I am using Message
Driven POJOs I don't have access to low level message details. Any idea
is highly appreciated.

 

Thanks

 

 


Re: No effect on maximumRedeliveries setting

Posted by "Christopher G. Stach II" <cg...@ldsys.net>.
James Strachan wrote:
> On 2/1/07, Christopher G. Stach II <cg...@ldsys.net> wrote:
>> James Strachan wrote:
>> > I'd certainly recommend never using the
>> > org.apache.activemq.pool.PooledConnectionFactory for anything other
>> > than sending messages with Spring's JmsTemplate as described here
>> > http://activemq.apache.org/spring-support.html
>> >
>> > am not sure if thats causing the issue or not.
>> >
>> > If not it could be a Spring issue. e.g. try write some JMS code to try
>> > consume & roll back a transaction a number of times to check things
>> > are working properly with your particular spring.xml before moving on
>> > to the spring JMS containers
>>
>> How about adding an example of a Spring configuration using JCA (Jencks,
>> I guess) for inbound messages, the pooled connection factory for
>> outbound, all JTA, and preferably using the inbound connection for the
>> JCA inbound messages? :)
> 
> So just to make things 100% clear - the purpose of
> PooledConnectionFactory is only for use outside of a J2EE container
> and when not using JCA - for users who want to use Spring's
> JmsTemplate (i.e. for sending messages only).
> 
> For an example of inbound and outbound messaging with JCA here you go....
> 
> inbound
> http://jencks.org/Message+Driven+POJOs
> 
> outbound
> http://jencks.org/Outbound+JMS
> 
> Note that neither examples use PooledConnectionFactory since JCA does
> all the pooling for you for both inbound and outbound (as well as
> registering with XA etc)
> 

JCA with Jencks would be used outside of a container.  Wasn't one of the
main goals of amqpool to have XA with improved performance through
session pooling, something that the RA doesn't do?  So, why wouldn't one
want to use amqpool for outbound and the regular JCA setup for inbound?

-- 
Christopher G. Stach II


RE: No effect on maximumRedeliveries setting

Posted by Nilantha Jayalath <Ni...@autodata.net>.
Thanks James for your explanation on Connection Factories,

Now I am using Jencks 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
could be 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? Thank you in advance for any idea on this

-Nilantha

-----Original Message-----
From: James Strachan [mailto:james.strachan@gmail.com] 
Sent: Friday, February 02, 2007 8:02 AM
To: users@activemq.apache.org
Subject: Re: No effect on maximumRedeliveries setting

------

So just to make things 100% clear - the purpose of
PooledConnectionFactory is only for use outside of a J2EE container
and when not using JCA - for users who want to use Spring's
JmsTemplate (i.e. for sending messages only).

For an example of inbound and outbound messaging with JCA here you
go....

inbound
http://jencks.org/Message+Driven+POJOs

outbound
http://jencks.org/Outbound+JMS

Note that neither examples use PooledConnectionFactory since JCA does
all the pooling for you for both inbound and outbound (as well as
registering with XA etc)

-- 

James
-------
http://radio.weblogs.com/0112098/

Re: No effect on maximumRedeliveries setting

Posted by James Strachan <ja...@gmail.com>.
On 2/1/07, Christopher G. Stach II <cg...@ldsys.net> wrote:
> James Strachan wrote:
> > I'd certainly recommend never using the
> > org.apache.activemq.pool.PooledConnectionFactory for anything other
> > than sending messages with Spring's JmsTemplate as described here
> > http://activemq.apache.org/spring-support.html
> >
> > am not sure if thats causing the issue or not.
> >
> > If not it could be a Spring issue. e.g. try write some JMS code to try
> > consume & roll back a transaction a number of times to check things
> > are working properly with your particular spring.xml before moving on
> > to the spring JMS containers
>
> How about adding an example of a Spring configuration using JCA (Jencks,
> I guess) for inbound messages, the pooled connection factory for
> outbound, all JTA, and preferably using the inbound connection for the
> JCA inbound messages? :)

So just to make things 100% clear - the purpose of
PooledConnectionFactory is only for use outside of a J2EE container
and when not using JCA - for users who want to use Spring's
JmsTemplate (i.e. for sending messages only).

For an example of inbound and outbound messaging with JCA here you go....

inbound
http://jencks.org/Message+Driven+POJOs

outbound
http://jencks.org/Outbound+JMS

Note that neither examples use PooledConnectionFactory since JCA does
all the pooling for you for both inbound and outbound (as well as
registering with XA etc)

-- 

James
-------
http://radio.weblogs.com/0112098/

Re: No effect on maximumRedeliveries setting

Posted by "Christopher G. Stach II" <cg...@ldsys.net>.
James Strachan wrote:
> I'd certainly recommend never using the
> org.apache.activemq.pool.PooledConnectionFactory for anything other
> than sending messages with Spring's JmsTemplate as described here
> http://activemq.apache.org/spring-support.html
> 
> am not sure if thats causing the issue or not.
> 
> If not it could be a Spring issue. e.g. try write some JMS code to try
> consume & roll back a transaction a number of times to check things
> are working properly with your particular spring.xml before moving on
> to the spring JMS containers

How about adding an example of a Spring configuration using JCA (Jencks,
I guess) for inbound messages, the pooled connection factory for
outbound, all JTA, and preferably using the inbound connection for the
JCA inbound messages? :)

-- 
Christopher G. Stach II


RE: No effect on maximumRedeliveries setting

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

-----Original Message-----
From: James Strachan [mailto:james.strachan@gmail.com] 
Sent: Thursday, February 01, 2007 11:58 AM
To: users@activemq.apache.org
Subject: Re: No effect on maximumRedeliveries setting

I'd certainly recommend never using the
org.apache.activemq.pool.PooledConnectionFactory for anything other
than sending messages with Spring's JmsTemplate as described here
http://activemq.apache.org/spring-support.html

am not sure if thats causing the issue or not.

If not it could be a Spring issue. e.g. try write some JMS code to try
consume & roll back a transaction a number of times to check things
are working properly with your particular spring.xml before moving on
to the spring JMS containers



On 2/1/07, Nilantha Jayalath <Ni...@autodata.net> wrote:
> I am using Sprin's DefaultMessageListenerContainer to consume
messages.
> What I noticed was "maximumRedeliveries" setting is not effective for
> some reason. It just keeps redelivering messages.
>
> Following is my connectionFactory setting.
>
> According to the ActiveMQ documentation it seems a "Poison ack" is not
> being sent back to the broker letting him know that the message was
> considered a poison pill.
>
>
>
> Am I missing anything here?
>
>
>
>       <bean id="connectionFactory"
> class="org.apache.activemq.pool.PooledConnectionFactory">
>
>       <property name="connectionFactory">
>
>             <bean
class="org.apache.activemq.ActiveMQConnectionFactory">
>
>             <property name="brokerURL" value="failover:(tcp://.....)"
/>
>
>             <property name="redeliveryPolicy">
>
>                   <bean class="org.apache.activemq.RedeliveryPolicy">
>
>                         <property name="maximumRedeliveries"
value="3"/>
>
>                         <property name="backOffMultiplier" value="2"/>
>
>                         <property name="initialRedeliveryDelay"
> value="50"/>
>
>                         <property name="useExponentialBackOff"
> value="true"/>
>
>                   </bean>
>
>             </property>
>
>             </bean>
>
>       </property>
>
>             <property name="maximumActive" value="8" />
>
>       </bean>
>
>
>
> Came across following
>
>
http://www.oreillynet.com/onjava/blog/2006/01/message_redelivery_and_dlq
> _tip.html
>
> Is this still valid for the AMQ 4.1.0 as well? Since I am using
Message
> Driven POJOs I don't have access to low level message details. Any
idea
> is highly appreciated.
>
>
>
> Thanks
>
>
>
>
>
>
>


-- 

James
-------
http://radio.weblogs.com/0112098/

Re: No effect on maximumRedeliveries setting

Posted by James Strachan <ja...@gmail.com>.
I'd certainly recommend never using the
org.apache.activemq.pool.PooledConnectionFactory for anything other
than sending messages with Spring's JmsTemplate as described here
http://activemq.apache.org/spring-support.html

am not sure if thats causing the issue or not.

If not it could be a Spring issue. e.g. try write some JMS code to try
consume & roll back a transaction a number of times to check things
are working properly with your particular spring.xml before moving on
to the spring JMS containers



On 2/1/07, Nilantha Jayalath <Ni...@autodata.net> wrote:
> I am using Sprin's DefaultMessageListenerContainer to consume messages.
> What I noticed was "maximumRedeliveries" setting is not effective for
> some reason. It just keeps redelivering messages.
>
> Following is my connectionFactory setting.
>
> According to the ActiveMQ documentation it seems a "Poison ack" is not
> being sent back to the broker letting him know that the message was
> considered a poison pill.
>
>
>
> Am I missing anything here?
>
>
>
>       <bean id="connectionFactory"
> class="org.apache.activemq.pool.PooledConnectionFactory">
>
>       <property name="connectionFactory">
>
>             <bean class="org.apache.activemq.ActiveMQConnectionFactory">
>
>             <property name="brokerURL" value="failover:(tcp://.....)" />
>
>             <property name="redeliveryPolicy">
>
>                   <bean class="org.apache.activemq.RedeliveryPolicy">
>
>                         <property name="maximumRedeliveries" value="3"/>
>
>                         <property name="backOffMultiplier" value="2"/>
>
>                         <property name="initialRedeliveryDelay"
> value="50"/>
>
>                         <property name="useExponentialBackOff"
> value="true"/>
>
>                   </bean>
>
>             </property>
>
>             </bean>
>
>       </property>
>
>             <property name="maximumActive" value="8" />
>
>       </bean>
>
>
>
> Came across following
>
> http://www.oreillynet.com/onjava/blog/2006/01/message_redelivery_and_dlq
> _tip.html
>
> Is this still valid for the AMQ 4.1.0 as well? Since I am using Message
> Driven POJOs I don't have access to low level message details. Any idea
> is highly appreciated.
>
>
>
> Thanks
>
>
>
>
>
>
>


-- 

James
-------
http://radio.weblogs.com/0112098/