You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by clar <cl...@hotmail.com> on 2013/10/30 02:59:22 UTC

Re: Different deadLetterStrategies for different queues

Gary Tully <ga...@...> writes:

> 
> For destination D you still need to specify a real/concrete strategy,
> either individualDeadLetterStrategy or shared will work:
> 
> <policyEntry queue="D" producerFlowControl="true" memoryLimit="10mb">
>  <deadLetterStrategy>
>    <individualDeadLetterStrategy processExpired="false"/>
>  </deadLetterStrategy>
> </policyEntry>
> 
> On 1 April 2010 10:40, Jan Dev <ja...@...> wrote:
> 
> >
> > Hi all
> >
> > I am using ActiveMQ 5.3.0.
> > I have lots of queues. Lets say I have queue A,B,C,D
> >
> > Queues A,B,C should have their own DLQ. Thus I configure the following:
> >
> > <policyEntry queue=">" producerFlowControl="true" memoryLimit="50mb">
> >  <deadLetterStrategy>
> >    <individualDeadLetterStrategy queuePrefix="DLQ."
> > useQueueForQueueMessages="true" />
> > </deadLetterStrategy>
> > </policyEntry>
> >
> > For Queue "D" I don't want to have DLQ. Expired Messages shall not be 
kept.
> > So I add the following:
> > <policyEntry queue="D" producerFlowControl="true" memoryLimit="10mb">
> >  <deadLetterStrategy processExpired="false" />
> > </policyEntry>
> >
> > When I restart ActiveMQ to re-read the configuration it throws the
> > exception
> > below.
> > How do I configure different dead letter strategies for different 
queues?
> >
> > Many thanks for your help.
> >
> > Regards
> > Jan
> >
> >
> > ERROR: java.lang.Exception:
> > org.springframework.beans.factory.BeanCreationException: Error creating
> > bean
> > with name 'org.apache.activemq.xbean.XBeanBrokerService#0' defined in 
class
> > path resource [activemq.xml]: Cannot create inner bean '(inner bean)' of
> > type [org.apache.activemq.broker.region.policy.PolicyMap] while setting
> > bean
> > property 'destinationPolicy'; nested exception is
> > org.springframework.beans.factory.BeanCreationException: Error creating
> > bean
> > with name '(inner bean)#2' defined in class path resource 
[activemq.xml]:
> > Cannot create inner bean 'policyEntry#922804' of type
> > [org.apache.activemq.broker.region.policy.PolicyEntry] while setting 
bean
> > property 'policyEntries' with key [2]; nested exception is
> > org.springframework.beans.factory.BeanCreationException: Error creating
> > bean
> > with name 'policyEntry#922804' defined in class path resource
> > [activemq.xml]: Initialization of bean failed; nested exception is
> > org.springframework.beans.TypeMismatchException: Failed to convert 
property
> > value of type [java.lang.String] to required type
> > [org.apache.activemq.broker.region.policy.DeadLetterStrategy] for 
property
> > 'deadLetterStrategy'; nested exception is
> > java.lang.IllegalArgumentException: Cannot convert value of type
> > [java.lang.String] to required type
> > [org.apache.activemq.broker.region.policy.DeadLetterStrategy] for 
property
> > 'deadLetterStrategy': no matching editors or conversion strategy found
> > java.lang.Exception:
> > org.springframework.beans.factory.BeanCreationException: Error creating
> > bean
> > with name 'org.apache.activemq.xbean.XBeanBrokerService#0' defined in 
class
> > path resource [activemq.xml]: Cannot create inner bean '(inner bean)' of
> > type [org.apache.activemq.broker.region.policy.PolicyMap] while setting
> > bean
> > property 'destinationPolicy'; nested exception is
> > org.springframework.beans.factory.BeanCreationException: Error creating
> > bean
> > with name '(inner bean)#2' defined in class path resource 
[activemq.xml]:
> > Cannot create inner bean 'policyEntry#922804' of type
> > [org.apache.activemq.broker.region.policy.PolicyEntry] while setting 
bean
> > property 'policyEntries' with key [2]; nested exception is
> > org.springframework.beans.factory.BeanCreationException: Error creating
> > bean
> > with name 'policyEntry#922804' defined in class path resource
> > [activemq.xml]: Initialization of bean failed; nested exception is
> > org.springframework.beans.TypeMismatchException: Failed to convert 
property
> > value of type [java.lang.String] to required type
> > [org.apache.activemq.broker.region.policy.DeadLetterStrategy] for 
property
> > 'deadLetterStrategy'; nested exception is
> > java.lang.IllegalArgumentException: Cannot convert value of type
> > [java.lang.String] to required type
> > [org.apache.activemq.broker.region.policy.DeadLetterStrategy] for 
property
> > 'deadLetterStrategy': no matching editors or conversion strategy found
> >        at
> >
> > 
org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:9
9)
> >        at
> >
> > 
org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.
java:57)
> >        at
> >
> > 
org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:1
29)
> >        at
> >
> > 
org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.
java:57)
> >        at
> > 
org.apache.activemq.console.command.ShellCommand.main(ShellCommand.java:79)
> >        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> >        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown 
Source)
> >        at java.lang.reflect.Method.invoke(Unknown Source)
> >        at org.apache.activemq.console.Main.runTaskClass(Main.java:251)
> >        at org.apache.activemq.console.Main.main(Main.java:107)
> >        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> >        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown 
Source)
> >        at java.lang.reflect.Method.invoke(Unknown Source)
> >        at
> > 
org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:240)
> >        at java.lang.Thread.run(Unknown Source)
> > Caused by: org.springframework.beans.factory.BeanCreationException: 
Error
> > creating bean with name 'org.apache.activemq.xbean.XBeanBrokerService#0'
> > defined in class path resource [activemq.xml]: Cannot create inner bean
> > '(inner bean)' of type 
[org.apache.activemq.broker.region.policy.PolicyMap]
> > while setting bean property 'destinationPolicy'; nested exception is
> > org.springframework.beans.factory.BeanCreationException: Error creating
> > bean
> > with name '(inner bean)#2' defined in class path resource 
[activemq.xml]:
> > Cannot create inner bean 'policyEntry#922804' of type
> > [org.apache.activemq.broker.region.policy.PolicyEntry] while setting 
bean
> > property 'policyEntries' with key [2]; nested exception is
> > org.springframework.beans.factory.BeanCreationException: Error creating
> > bean
> > with name 'policyEntry#922804' defined in class path resource
> > [activemq.xml]: Initialization of bean failed; nested exception is
> > org.springframework.beans.TypeMismatchException: Failed to convert 
property
> > value of type [java.lang.String] to required type
> > [org.apache.activemq.broker.region.policy.DeadLetterStrategy] for 
property
> > 'deadLetterStrategy'; nested exception is
> > java.lang.IllegalArgumentException: Cannot convert value of type
> > [java.lang.String] to required type
> > [org.apache.activemq.broker.region.policy.DeadLetterStrategy] for 
property
> > 'deadLetterStrategy': no matching editors or conversion strategy found
> >        at
> >
> > 
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolv
eInnerBean(BeanDefinitionValueResolver.java:230)
> >        at
> >
> > 
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolv
eValueIfNecessary(BeanDefinitionValueResolver.java:122)
> >        at
> >
> > 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1245)
> >        at
> >
> > 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
.populateBean(AbstractAutowireCapableBeanFactory.java:1010)
> >        at
> >
> > 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
> >        at
> >
> > 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
$1.run(AbstractAutowireCapableBeanFactory.java:409)
> >        at java.security.AccessController.doPrivileged(Native Method)
> >        at
> >
> > 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
.createBean(AbstractAutowireCapableBeanFactory.java:380)
> >        at
> >
> > 
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(Ab
stractBeanFactory.java:264)
> >        at
> >
> > 
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSi
ngleton(DefaultSingletonBeanRegistry.java:222)
> >        at
> >
> > 
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(Abst
ractBeanFactory.java:261)
> >        at
> >
> > 
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(Abstra
ctBeanFactory.java:185)
> >        at
> >
> > 
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(Abstra
ctBeanFactory.java:164)
> >        at
> >
> > 
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInst
antiateSingletons(DefaultListableBeanFactory.java:429)
> >        at
> >
> > 
org.springframework.context.support.AbstractApplicationContext.finishBeanFac
toryInitialization(AbstractApplicationContext.java:728)
> >        at
> >
> > 
org.springframework.context.support.AbstractApplicationContext.refresh(Abstr
actApplicationContext.java:380)
> >        at
> >
> > org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>
(ResourceXmlApplicationContext.java:64)
> >        at
> >
> > org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>
(ResourceXmlApplicationContext.java:52)
> >        at
> >
> > 
org.apache.activemq.xbean.XBeanBrokerFactory.createApplicationContext(XBeanB
rokerFactory.java:96)
> >        at
> >
> > 
org.apache.activemq.xbean.XBeanBrokerFactory.createBroker(XBeanBrokerFactory
.java:52)
> >        at
> >
> > 
org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:71)
> >        at
> >
> > 
org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:54)
> >        at
> >
> > 
org.apache.activemq.console.command.StartCommand.startBroker(StartCommand.ja
va:115)
> >        at
> >
> > 
org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:7
4)
> >        ... 16 more
> > Caused by: org.springframework.beans.factory.BeanCreationException: 
Error
> > creating bean with name '(inner bean)#2' defined in class path resource
> > [activemq.xml]: Cannot create inner bean 'policyEntry#922804' of type
> > [org.apache.activemq.broker.region.policy.PolicyEntry] while setting 
bean
> > property 'policyEntries' with key [2]; nested exception is
> > org.springframework.beans.factory.BeanCreationException: Error creating
> > bean
> > with name 'policyEntry#922804' defined in class path resource
> > [activemq.xml]: Initialization of bean failed; nested exception is
> > org.springframework.beans.TypeMismatchException: Failed to convert 
property
> > value of type [java.lang.String] to required type
> > [org.apache.activemq.broker.region.policy.DeadLetterStrategy] for 
property
> > 'deadLetterStrategy'; nested exception is
> > java.lang.IllegalArgumentException: Cannot convert value of type
> > [java.lang.String] to required type
> > [org.apache.activemq.broker.region.policy.DeadLetterStrategy] for 
property
> > 'deadLetterStrategy': no matching editors or conversion strategy found
> >        at
> >
> > 
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolv
eInnerBean(BeanDefinitionValueResolver.java:230)
> >        at
> >
> > 
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolv
eValueIfNecessary(BeanDefinitionValueResolver.java:117)
> >        at
> >
> > 
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolv
eManagedList(BeanDefinitionValueResolver.java:287)
> >        at
> >
> > 
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolv
eValueIfNecessary(BeanDefinitionValueResolver.java:126)
> >        at
> >
> > 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1245)
> >        at
> >
> > 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
.populateBean(AbstractAutowireCapableBeanFactory.java:1010)
> >        at
> >
> > 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
> >        at
> >
> > 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
$1.run(AbstractAutowireCapableBeanFactory.java:409)
> >        at java.security.AccessController.doPrivileged(Native Method)
> >        at
> >
> > 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
.createBean(AbstractAutowireCapableBeanFactory.java:380)
> >        at
> >
> > 
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolv
eInnerBean(BeanDefinitionValueResolver.java:219)
> >        ... 39 more
> > Caused by: org.springframework.beans.factory.BeanCreationException: 
Error
> > creating bean with name 'policyEntry#922804' defined in class path 
resource
> > [activemq.xml]: Initialization of bean failed; nested exception is
> > org.springframework.beans.TypeMismatchException: Failed to convert 
property
> > value of type [java.lang.String] to required type
> > [org.apache.activemq.broker.region.policy.DeadLetterStrategy] for 
property
> > 'deadLetterStrategy'; nested exception is
> > java.lang.IllegalArgumentException: Cannot convert value of type
> > [java.lang.String] to required type
> > [org.apache.activemq.broker.region.policy.DeadLetterStrategy] for 
property
> > 'deadLetterStrategy': no matching editors or conversion strategy found
> >        at
> >
> > 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
.doCreateBean(AbstractAutowireCapableBeanFactory.java:480)
> >        at
> >
> > 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
$1.run(AbstractAutowireCapableBeanFactory.java:409)
> >        at java.security.AccessController.doPrivileged(Native Method)
> >        at
> >
> > 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
.createBean(AbstractAutowireCapableBeanFactory.java:380)
> >        at
> >
> > 
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolv
eInnerBean(BeanDefinitionValueResolver.java:219)
> >        ... 49 more
> > Caused by: org.springframework.beans.TypeMismatchException: Failed to
> > convert property value of type [java.lang.String] to required type
> > [org.apache.activemq.broker.region.policy.DeadLetterStrategy] for 
property
> > 'deadLetterStrategy'; nested exception is
> > java.lang.IllegalArgumentException: Cannot convert value of type
> > [java.lang.String] to required type
> > [org.apache.activemq.broker.region.policy.DeadLetterStrategy] for 
property
> > 'deadLetterStrategy': no matching editors or conversion strategy found
> >        at
> >
> > 
org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl
.java:391)
> >        at
> >
> > 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
.convertForProperty(AbstractAutowireCapableBeanFactory.java:1289)
> >        at
> >
> > 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1250)
> >        at
> >
> > 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
.populateBean(AbstractAutowireCapableBeanFactory.java:1010)
> >        at
> >
> > 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
> >        ... 53 more
> > Caused by: java.lang.IllegalArgumentException: Cannot convert value of 
type
> > [java.lang.String] to required type
> > [org.apache.activemq.broker.region.policy.DeadLetterStrategy] for 
property
> > 'deadLetterStrategy': no matching editors or conversion strategy found
> >        at
> >
> > 
org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConve
rterDelegate.java:231)
> >        at
> >
> > 
org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConve
rterDelegate.java:138)
> >        at
> >
> > 
org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl
.java:386)
> >        ... 57 more
> >
> >
> >
> >
> >
> >
> > --
> > View this message in context:
> > http://old.nabble.com/Different-deadLetterStrategies-for-different-
queues-tp28106200p28106200.html
> > Sent from the ActiveMQ - User mailing list archive at Nabble.com.
> >
> >
> 

Hi, I wanted to set dead message to a specific queue, at the same time 
discard expired message. Below is a snippet of my activemq.xml.

<destinationPolicy> 
      <policyMap> 
        <policyEntries> 
          <policyEntry queue=">" producerFlowControl="true" 
memoryLimit="1mb"> 
            <deadLetterStrategy> 
              <individualDeadLetterStrategy queuePrefix="DLQ." 
useQueueForQueueMessages="true" processExpired="false" 
processNonPersistent="false"/> 
            </deadLetterStrategy> 
            <pendingQueuePolicy> 
                <vmQueueCursor /> 
            </pendingQueuePolicy> 
          </policyEntry> 
        </policyEntries> 
      </policyMap> 
    </destinationPolicy>


But however, the message does not seems to be discarded even though I  had 
set time to live to 10 sec. It still goes to the specific DLQ. Any idea 
where has gone wrong? Many thanks.