You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Marc Giger <gi...@gmx.ch> on 2008/03/07 22:21:47 UTC

spring DeadLetterChannel redelivery config

Hi,

I'm trying to configure the DeadLetterChannel with spring.
Unfortunately without success. No matter where I declare the
<onException>, camel tries to redeliver the message 5 times in the case
of an exception.

How must the following configuration be modified so that camel just
tries to deliver once?

<camelContext id="camel"
xmlns="http://activemq.apache.org/camel/schema/spring">
<route> 
            <from uri="cxf:bean:routerEndpoint"/>
            <onException> <!-- no effect -->
                <redeliveryPolicy>
                    <maximumRedeliveries>0</maximumRedeliveries>
                </redeliveryPolicy>
            </onException>
            <process ref="decryptProcessor">
                <onException> <!-- no effect -->
                    <redeliveryPolicy>
                        <maximumRedeliveries>0</maximumRedeliveries>
                    </redeliveryPolicy>
                </onException>
            </process>
            <choice>
                <when>
                    <methodCall bean="endpointSelector"
method="matches"/> <to
uri="cxf:bean:serviceEndpoint?dataFormat=MESSAGE"/> </when>
                <otherwise>
                    <to
uri="cxf:bean:localEndpoint"/> </otherwise>
            </choice>            
        </route>
    </camelContext>

Thanks a lot!

Cheers,

Marc

RE: spring DeadLetterChannel redelivery config

Posted by vguna <gr...@gmx.de>.
Hi Claus.

Sure: https://issues.apache.org/activemq/browse/CAMEL-683

Regards,
Veit




Claus Ibsen wrote:
> 
> Hi
> 
> Thanks a lot for sharing this. Handy for others as well.
> There could be an issue with the initial delay vs. repated delay.
> 
> Do you mind creating a JIRA ticket for this - then its not forgotten.
> Would be nice with a special delay for the first redelivery and then
> another setting for the repeated delay. 
> 
> 
> Med venlig hilsen
>  
> Claus Ibsen
> ......................................
> Silverbullet
> Skovsgårdsvænget 21
> 8362 Hørning
> Tlf. +45 2962 7576
> Web: www.silverbullet.dk
> 
> -----Original Message-----
> From: vguna [mailto:grave@gmx.de] 
> Sent: 7. juli 2008 11:17
> To: camel-user@activemq.apache.org
> Subject: Re: spring DeadLetterChannel redelivery config
> 
> 
> Hi James.
> 
> Thanks for the reply. It seems to work now. For all, who asking themselves
> how a xml configuration for this will look like, here's an example:
> 
>     <camelContext id="camel"
> xmlns="http://activemq.apache.org/camel/schema/spring">
> 
>         <route errorHandlerRef="deadLetterErrorHandler">
>                 <from uri="activemq:NEW" />
>         </route>
> 
>     </camelContext>
> 
> <bean id="deadLetterErrorHandler"
> class="org.apache.camel.builder.DeadLetterChannelBuilder">
>     <property name="redeliveryPolicy" ref="redeliveryPolicyConfig"/>
> </bean>
> 
> <bean id="redeliveryPolicyConfig"
> class="org.apache.camel.processor.RedeliveryPolicy">
>     <property name="maximumRedeliveries" value="4"/>
>     <property name="initialRedeliveryDelay" value="30000"/>
>     <property name="useExponentialBackOff" value="true"/>
> </bean>
> 
> 
> Still one problem left. When an error occurs, a redelivery is executed
> immediately - without the specified delay. After
> that, the redeliveryDelay is used correctly.Is this by design? Would be
> nice, if one could configure a "redeliveryDelay" and a
> "initialRedliveryDelay". Or just simply use the delay on the first
> redelivery attempt, too.
> 
> Regards,
> Veit
> 
> 
> 
> 
> 
> James.Strachan wrote:
>> 
>> I've recently fixed this...
>> 
>> https://issues.apache.org/activemq/browse/CAMEL-662
>> 
>> so you can now specify an errorHandlerRef on a <camelContext> a
>> <route> or <pipeline> element to refer to a spring bean which could be
>> a DeadLetterChannelBuilder or a TransactionalErrorHandlerBuilder etc.
>> 
>> i.e. you can define the errror handler as a normal spring bean now
>> 
>> 2008/3/7 Marc Giger <gi...@gmx.ch>:
>>> Hi,
>>>
>>> I'm trying to configure the DeadLetterChannel with spring.
>>> Unfortunately without success. No matter where I declare the
>>> <onException>, camel tries to redeliver the message 5 times in the case
>>> of an exception.
>>>
>>> How must the following configuration be modified so that camel just
>>> tries to deliver once?
>>>
>>> <camelContext id="camel"
>>> xmlns="http://activemq.apache.org/camel/schema/spring">
>>> <route>
>>>            <from uri="cxf:bean:routerEndpoint"/>
>>>            <onException> <!-- no effect -->
>>>                <redeliveryPolicy>
>>>                    <maximumRedeliveries>0</maximumRedeliveries>
>>>                </redeliveryPolicy>
>>>            </onException>
>>>            <process ref="decryptProcessor">
>>>                <onException> <!-- no effect -->
>>>                    <redeliveryPolicy>
>>>                        <maximumRedeliveries>0</maximumRedeliveries>
>>>                    </redeliveryPolicy>
>>>                </onException>
>>>            </process>
>>>            <choice>
>>>                <when>
>>>                    <methodCall bean="endpointSelector"
>>> method="matches"/> <to
>>> uri="cxf:bean:serviceEndpoint?dataFormat=MESSAGE"/> </when>
>>>                <otherwise>
>>>                    <to
>>> uri="cxf:bean:localEndpoint"/> </otherwise>
>>>            </choice>
>>>        </route>
>>>    </camelContext>
>>>
>>> Thanks a lot!
>>>
>>> Cheers,
>>>
>>> Marc
>>>
>> 
>> 
>> 
>> -- 
>> James
>> -------
>> http://macstrac.blogspot.com/
>> 
>> Open Source Integration
>> http://open.iona.com
>> 
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/spring-DeadLetterChannel-redelivery-config-tp15906561s22882p18312842.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/spring-DeadLetterChannel-redelivery-config-tp15906561s22882p18313436.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RE: spring DeadLetterChannel redelivery config

Posted by Claus Ibsen <ci...@silverbullet.dk>.
Hi

Really glad you got it working and sharing your findings with us.
Good luck, and please ask again for any help related to Camel.


Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: vguna [mailto:grave@gmx.de] 
Sent: 8. juli 2008 13:49
To: camel-user@activemq.apache.org
Subject: RE: spring DeadLetterChannel redelivery config


Hi Claus.

Meanwhile I've realized that the problem is a misunderstanding on my side
what camel is supposed to do.
I thought I can configure the redelivery behavior of ActiveMQ within the
camelContext as part of the acivemq.xml configuration on a per destination
basis. What I haven't mentioned is, that my listener/consumer for the queue
isn't configured within camel or activemq but in a separate spring baked
application. What I now have realized is, that I have to consume a message
via camel to get it's routing/mediation support (including redelivery
features) - now it's crystal clear to me (or not?). So I configured
redeliveryPolicy on a ActiveMQConnectionFactory on my spring baked
application and the settings are working fine now.

Sorry for mixing things up.

Thanks for you help.

Regards,
Veit




Claus Ibsen wrote:
> 
> Hi
> 
> mvn camel:run is a maven target to run your camel project standalone, its
> meant for quick and dirty prototype and trying it our along as you code.
> 
> If you do not use maven for your project then you can start Camel by the
> Main class in org.apache.camel.spring.Main (that is actually started by
> mvn camel:run).
> 
> A little more here:
> http://activemq.apache.org/camel/running-camel-standalone.html
> 
> 
> Med venlig hilsen
>  
> Claus Ibsen
> ......................................
> Silverbullet
> Skovsgårdsvænget 21
> 8362 Hørning
> Tlf. +45 2962 7576
> Web: www.silverbullet.dk
> 
> -----Original Message-----
> From: vguna [mailto:grave@gmx.de] 
> Sent: 7. juli 2008 16:22
> To: camel-user@activemq.apache.org
> Subject: RE: spring DeadLetterChannel redelivery config
> 
> 
> Hi.
> 
> Ehhw. I'm afraid I'm not too deep into camel yet. camel:run means that it
> is
> a maven target on the source distribution
> of camel? I can try that of course...
> 
> 
> 
> Claus Ibsen wrote:
>> 
>> Hi
>> 
>> Can you try running it outside ActiveMQ eg from camel:run. To see that it
>> works. Then we can identify the problem with ActiveMQ later.
>> 
>> I have added a unit test to camel-spring that works with your
>> configuration.
>> It gets the DeadLetterChannel that is configured as a spring bean and
>> uses
>> the redelivery prorperties as well.
>> 
>> 
>> 
>> Med venlig hilsen
>>  
>> Claus Ibsen
>> ......................................
>> Silverbullet
>> Skovsgårdsvænget 21
>> 8362 Hørning
>> Tlf. +45 2962 7576
>> Web: www.silverbullet.dk
>> 
>> -----Original Message-----
>> From: vguna [mailto:grave@gmx.de] 
>> Sent: 7. juli 2008 13:49
>> To: camel-user@activemq.apache.org
>> Subject: RE: spring DeadLetterChannel redelivery config
>> 
>> 
>> Hi again.
>> 
>> I recently encountered that the redeliveryPolicy still doesn't work as
>> expected. Basically it does the redelivery - but with default settings as
>> it
>> seems.
>> 
>> Tried this configuration in activemq.xml with camel 1.4 snapshot:
>> 
>>     <camelContext id="camel"
>> xmlns="http://activemq.apache.org/camel/schema/spring">
>> 
>>         <route errorHandlerRef="deadLetterErrorHandler">
>>                 <from uri="activemq:NEW" />
>>         </route>
>>     </camelContext>
>> 
>> <bean id="deadLetterErrorHandler"
>> class="org.apache.camel.builder.DeadLetterChannelBuilder">
>>     <property name="redeliveryPolicy" ref="redeliveryPolicyConfig"/>
>> </bean>
>> 
>> <bean id="redeliveryPolicyConfig"
>> class="org.apache.camel.processor.RedeliveryPolicy">
>>     <property name="maximumRedeliveries" value="3"/>
>>     <property name="initialRedeliveryDelay" value="10000"/>
>>     <property name="useExponentialBackOff" value="true"/>
>>     <property name="backOffMultiplier" value="2" />
>> </bean>
>> 
>> Redelivery takes place in 30 seconds with a retry count of 5 instead of
>> the
>> values configured. This might be because the errorHandlerRef on route
>> isn't
>> evaluated at all. If I change this to foobar, it doesn't complain about
>> it
>> on startup.
>> 
>> So what I'm doing wrong?
>> 
>> Regards,
>> Veit
>> 
>> 
>> 
>> 
>> Claus Ibsen wrote:
>>> 
>>> Hi
>>> 
>>> Thanks a lot for sharing this. Handy for others as well.
>>> There could be an issue with the initial delay vs. repated delay.
>>> 
>>> Do you mind creating a JIRA ticket for this - then its not forgotten.
>>> Would be nice with a special delay for the first redelivery and then
>>> another setting for the repeated delay. 
>>> 
>>> 
>>> Med venlig hilsen
>>>  
>>> Claus Ibsen
>>> ......................................
>>> Silverbullet
>>> Skovsgårdsvænget 21
>>> 8362 Hørning
>>> Tlf. +45 2962 7576
>>> Web: www.silverbullet.dk
>>> 
>>> -----Original Message-----
>>> From: vguna [mailto:grave@gmx.de] 
>>> Sent: 7. juli 2008 11:17
>>> To: camel-user@activemq.apache.org
>>> Subject: Re: spring DeadLetterChannel redelivery config
>>> 
>>> 
>>> Hi James.
>>> 
>>> Thanks for the reply. It seems to work now. For all, who asking
>>> themselves
>>> how a xml configuration for this will look like, here's an example:
>>> 
>>>     <camelContext id="camel"
>>> xmlns="http://activemq.apache.org/camel/schema/spring">
>>> 
>>>         <route errorHandlerRef="deadLetterErrorHandler">
>>>                 <from uri="activemq:NEW" />
>>>         </route>
>>> 
>>>     </camelContext>
>>> 
>>> <bean id="deadLetterErrorHandler"
>>> class="org.apache.camel.builder.DeadLetterChannelBuilder">
>>>     <property name="redeliveryPolicy" ref="redeliveryPolicyConfig"/>
>>> </bean>
>>> 
>>> <bean id="redeliveryPolicyConfig"
>>> class="org.apache.camel.processor.RedeliveryPolicy">
>>>     <property name="maximumRedeliveries" value="4"/>
>>>     <property name="initialRedeliveryDelay" value="30000"/>
>>>     <property name="useExponentialBackOff" value="true"/>
>>> </bean>
>>> 
>>> 
>>> Still one problem left. When an error occurs, a redelivery is executed
>>> immediately - without the specified delay. After
>>> that, the redeliveryDelay is used correctly.Is this by design? Would be
>>> nice, if one could configure a "redeliveryDelay" and a
>>> "initialRedliveryDelay". Or just simply use the delay on the first
>>> redelivery attempt, too.
>>> 
>>> Regards,
>>> Veit
>>> 
>>> 
>>> 
>>> 
>>> 
>>> James.Strachan wrote:
>>>> 
>>>> I've recently fixed this...
>>>> 
>>>> https://issues.apache.org/activemq/browse/CAMEL-662
>>>> 
>>>> so you can now specify an errorHandlerRef on a <camelContext> a
>>>> <route> or <pipeline> element to refer to a spring bean which could be
>>>> a DeadLetterChannelBuilder or a TransactionalErrorHandlerBuilder etc.
>>>> 
>>>> i.e. you can define the errror handler as a normal spring bean now
>>>> 
>>>> 2008/3/7 Marc Giger <gi...@gmx.ch>:
>>>>> Hi,
>>>>>
>>>>> I'm trying to configure the DeadLetterChannel with spring.
>>>>> Unfortunately without success. No matter where I declare the
>>>>> <onException>, camel tries to redeliver the message 5 times in the
>>>>> case
>>>>> of an exception.
>>>>>
>>>>> How must the following configuration be modified so that camel just
>>>>> tries to deliver once?
>>>>>
>>>>> <camelContext id="camel"
>>>>> xmlns="http://activemq.apache.org/camel/schema/spring">
>>>>> <route>
>>>>>            <from uri="cxf:bean:routerEndpoint"/>
>>>>>            <onException> <!-- no effect -->
>>>>>                <redeliveryPolicy>
>>>>>                    <maximumRedeliveries>0</maximumRedeliveries>
>>>>>                </redeliveryPolicy>
>>>>>            </onException>
>>>>>            <process ref="decryptProcessor">
>>>>>                <onException> <!-- no effect -->
>>>>>                    <redeliveryPolicy>
>>>>>                        <maximumRedeliveries>0</maximumRedeliveries>
>>>>>                    </redeliveryPolicy>
>>>>>                </onException>
>>>>>            </process>
>>>>>            <choice>
>>>>>                <when>
>>>>>                    <methodCall bean="endpointSelector"
>>>>> method="matches"/> <to
>>>>> uri="cxf:bean:serviceEndpoint?dataFormat=MESSAGE"/> </when>
>>>>>                <otherwise>
>>>>>                    <to
>>>>> uri="cxf:bean:localEndpoint"/> </otherwise>
>>>>>            </choice>
>>>>>        </route>
>>>>>    </camelContext>
>>>>>
>>>>> Thanks a lot!
>>>>>
>>>>> Cheers,
>>>>>
>>>>> Marc
>>>>>
>>>> 
>>>> 
>>>> 
>>>> -- 
>>>> James
>>>> -------
>>>> http://macstrac.blogspot.com/
>>>> 
>>>> Open Source Integration
>>>> http://open.iona.com
>>>> 
>>>> 
>>> 
>>> -- 
>>> View this message in context:
>>> http://www.nabble.com/spring-DeadLetterChannel-redelivery-config-tp15906561s22882p18312842.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>> 
>>> 
>>> 
>> 
>> -- 
>> View this message in context:
>> http://www.nabble.com/spring-DeadLetterChannel-redelivery-config-tp15906561s22882p18314952.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>> 
>> 
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/spring-DeadLetterChannel-redelivery-config-tp15906561s22882p18317673.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/spring-DeadLetterChannel-redelivery-config-tp15906561s22882p18337296.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RE: spring DeadLetterChannel redelivery config

Posted by vguna <gr...@gmx.de>.
Hi Claus.

Meanwhile I've realized that the problem is a misunderstanding on my side
what camel is supposed to do.
I thought I can configure the redelivery behavior of ActiveMQ within the
camelContext as part of the acivemq.xml configuration on a per destination
basis. What I haven't mentioned is, that my listener/consumer for the queue
isn't configured within camel or activemq but in a separate spring baked
application. What I now have realized is, that I have to consume a message
via camel to get it's routing/mediation support (including redelivery
features) - now it's crystal clear to me (or not?). So I configured
redeliveryPolicy on a ActiveMQConnectionFactory on my spring baked
application and the settings are working fine now.

Sorry for mixing things up.

Thanks for you help.

Regards,
Veit




Claus Ibsen wrote:
> 
> Hi
> 
> mvn camel:run is a maven target to run your camel project standalone, its
> meant for quick and dirty prototype and trying it our along as you code.
> 
> If you do not use maven for your project then you can start Camel by the
> Main class in org.apache.camel.spring.Main (that is actually started by
> mvn camel:run).
> 
> A little more here:
> http://activemq.apache.org/camel/running-camel-standalone.html
> 
> 
> Med venlig hilsen
>  
> Claus Ibsen
> ......................................
> Silverbullet
> Skovsgårdsvænget 21
> 8362 Hørning
> Tlf. +45 2962 7576
> Web: www.silverbullet.dk
> 
> -----Original Message-----
> From: vguna [mailto:grave@gmx.de] 
> Sent: 7. juli 2008 16:22
> To: camel-user@activemq.apache.org
> Subject: RE: spring DeadLetterChannel redelivery config
> 
> 
> Hi.
> 
> Ehhw. I'm afraid I'm not too deep into camel yet. camel:run means that it
> is
> a maven target on the source distribution
> of camel? I can try that of course...
> 
> 
> 
> Claus Ibsen wrote:
>> 
>> Hi
>> 
>> Can you try running it outside ActiveMQ eg from camel:run. To see that it
>> works. Then we can identify the problem with ActiveMQ later.
>> 
>> I have added a unit test to camel-spring that works with your
>> configuration.
>> It gets the DeadLetterChannel that is configured as a spring bean and
>> uses
>> the redelivery prorperties as well.
>> 
>> 
>> 
>> Med venlig hilsen
>>  
>> Claus Ibsen
>> ......................................
>> Silverbullet
>> Skovsgårdsvænget 21
>> 8362 Hørning
>> Tlf. +45 2962 7576
>> Web: www.silverbullet.dk
>> 
>> -----Original Message-----
>> From: vguna [mailto:grave@gmx.de] 
>> Sent: 7. juli 2008 13:49
>> To: camel-user@activemq.apache.org
>> Subject: RE: spring DeadLetterChannel redelivery config
>> 
>> 
>> Hi again.
>> 
>> I recently encountered that the redeliveryPolicy still doesn't work as
>> expected. Basically it does the redelivery - but with default settings as
>> it
>> seems.
>> 
>> Tried this configuration in activemq.xml with camel 1.4 snapshot:
>> 
>>     <camelContext id="camel"
>> xmlns="http://activemq.apache.org/camel/schema/spring">
>> 
>>         <route errorHandlerRef="deadLetterErrorHandler">
>>                 <from uri="activemq:NEW" />
>>         </route>
>>     </camelContext>
>> 
>> <bean id="deadLetterErrorHandler"
>> class="org.apache.camel.builder.DeadLetterChannelBuilder">
>>     <property name="redeliveryPolicy" ref="redeliveryPolicyConfig"/>
>> </bean>
>> 
>> <bean id="redeliveryPolicyConfig"
>> class="org.apache.camel.processor.RedeliveryPolicy">
>>     <property name="maximumRedeliveries" value="3"/>
>>     <property name="initialRedeliveryDelay" value="10000"/>
>>     <property name="useExponentialBackOff" value="true"/>
>>     <property name="backOffMultiplier" value="2" />
>> </bean>
>> 
>> Redelivery takes place in 30 seconds with a retry count of 5 instead of
>> the
>> values configured. This might be because the errorHandlerRef on route
>> isn't
>> evaluated at all. If I change this to foobar, it doesn't complain about
>> it
>> on startup.
>> 
>> So what I'm doing wrong?
>> 
>> Regards,
>> Veit
>> 
>> 
>> 
>> 
>> Claus Ibsen wrote:
>>> 
>>> Hi
>>> 
>>> Thanks a lot for sharing this. Handy for others as well.
>>> There could be an issue with the initial delay vs. repated delay.
>>> 
>>> Do you mind creating a JIRA ticket for this - then its not forgotten.
>>> Would be nice with a special delay for the first redelivery and then
>>> another setting for the repeated delay. 
>>> 
>>> 
>>> Med venlig hilsen
>>>  
>>> Claus Ibsen
>>> ......................................
>>> Silverbullet
>>> Skovsgårdsvænget 21
>>> 8362 Hørning
>>> Tlf. +45 2962 7576
>>> Web: www.silverbullet.dk
>>> 
>>> -----Original Message-----
>>> From: vguna [mailto:grave@gmx.de] 
>>> Sent: 7. juli 2008 11:17
>>> To: camel-user@activemq.apache.org
>>> Subject: Re: spring DeadLetterChannel redelivery config
>>> 
>>> 
>>> Hi James.
>>> 
>>> Thanks for the reply. It seems to work now. For all, who asking
>>> themselves
>>> how a xml configuration for this will look like, here's an example:
>>> 
>>>     <camelContext id="camel"
>>> xmlns="http://activemq.apache.org/camel/schema/spring">
>>> 
>>>         <route errorHandlerRef="deadLetterErrorHandler">
>>>                 <from uri="activemq:NEW" />
>>>         </route>
>>> 
>>>     </camelContext>
>>> 
>>> <bean id="deadLetterErrorHandler"
>>> class="org.apache.camel.builder.DeadLetterChannelBuilder">
>>>     <property name="redeliveryPolicy" ref="redeliveryPolicyConfig"/>
>>> </bean>
>>> 
>>> <bean id="redeliveryPolicyConfig"
>>> class="org.apache.camel.processor.RedeliveryPolicy">
>>>     <property name="maximumRedeliveries" value="4"/>
>>>     <property name="initialRedeliveryDelay" value="30000"/>
>>>     <property name="useExponentialBackOff" value="true"/>
>>> </bean>
>>> 
>>> 
>>> Still one problem left. When an error occurs, a redelivery is executed
>>> immediately - without the specified delay. After
>>> that, the redeliveryDelay is used correctly.Is this by design? Would be
>>> nice, if one could configure a "redeliveryDelay" and a
>>> "initialRedliveryDelay". Or just simply use the delay on the first
>>> redelivery attempt, too.
>>> 
>>> Regards,
>>> Veit
>>> 
>>> 
>>> 
>>> 
>>> 
>>> James.Strachan wrote:
>>>> 
>>>> I've recently fixed this...
>>>> 
>>>> https://issues.apache.org/activemq/browse/CAMEL-662
>>>> 
>>>> so you can now specify an errorHandlerRef on a <camelContext> a
>>>> <route> or <pipeline> element to refer to a spring bean which could be
>>>> a DeadLetterChannelBuilder or a TransactionalErrorHandlerBuilder etc.
>>>> 
>>>> i.e. you can define the errror handler as a normal spring bean now
>>>> 
>>>> 2008/3/7 Marc Giger <gi...@gmx.ch>:
>>>>> Hi,
>>>>>
>>>>> I'm trying to configure the DeadLetterChannel with spring.
>>>>> Unfortunately without success. No matter where I declare the
>>>>> <onException>, camel tries to redeliver the message 5 times in the
>>>>> case
>>>>> of an exception.
>>>>>
>>>>> How must the following configuration be modified so that camel just
>>>>> tries to deliver once?
>>>>>
>>>>> <camelContext id="camel"
>>>>> xmlns="http://activemq.apache.org/camel/schema/spring">
>>>>> <route>
>>>>>            <from uri="cxf:bean:routerEndpoint"/>
>>>>>            <onException> <!-- no effect -->
>>>>>                <redeliveryPolicy>
>>>>>                    <maximumRedeliveries>0</maximumRedeliveries>
>>>>>                </redeliveryPolicy>
>>>>>            </onException>
>>>>>            <process ref="decryptProcessor">
>>>>>                <onException> <!-- no effect -->
>>>>>                    <redeliveryPolicy>
>>>>>                        <maximumRedeliveries>0</maximumRedeliveries>
>>>>>                    </redeliveryPolicy>
>>>>>                </onException>
>>>>>            </process>
>>>>>            <choice>
>>>>>                <when>
>>>>>                    <methodCall bean="endpointSelector"
>>>>> method="matches"/> <to
>>>>> uri="cxf:bean:serviceEndpoint?dataFormat=MESSAGE"/> </when>
>>>>>                <otherwise>
>>>>>                    <to
>>>>> uri="cxf:bean:localEndpoint"/> </otherwise>
>>>>>            </choice>
>>>>>        </route>
>>>>>    </camelContext>
>>>>>
>>>>> Thanks a lot!
>>>>>
>>>>> Cheers,
>>>>>
>>>>> Marc
>>>>>
>>>> 
>>>> 
>>>> 
>>>> -- 
>>>> James
>>>> -------
>>>> http://macstrac.blogspot.com/
>>>> 
>>>> Open Source Integration
>>>> http://open.iona.com
>>>> 
>>>> 
>>> 
>>> -- 
>>> View this message in context:
>>> http://www.nabble.com/spring-DeadLetterChannel-redelivery-config-tp15906561s22882p18312842.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>> 
>>> 
>>> 
>> 
>> -- 
>> View this message in context:
>> http://www.nabble.com/spring-DeadLetterChannel-redelivery-config-tp15906561s22882p18314952.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>> 
>> 
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/spring-DeadLetterChannel-redelivery-config-tp15906561s22882p18317673.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/spring-DeadLetterChannel-redelivery-config-tp15906561s22882p18337296.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RE: spring DeadLetterChannel redelivery config

Posted by Claus Ibsen <ci...@silverbullet.dk>.
Hi

mvn camel:run is a maven target to run your camel project standalone, its meant for quick and dirty prototype and trying it our along as you code.

If you do not use maven for your project then you can start Camel by the Main class in org.apache.camel.spring.Main (that is actually started by mvn camel:run).

A little more here:
http://activemq.apache.org/camel/running-camel-standalone.html


Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: vguna [mailto:grave@gmx.de] 
Sent: 7. juli 2008 16:22
To: camel-user@activemq.apache.org
Subject: RE: spring DeadLetterChannel redelivery config


Hi.

Ehhw. I'm afraid I'm not too deep into camel yet. camel:run means that it is
a maven target on the source distribution
of camel? I can try that of course...



Claus Ibsen wrote:
> 
> Hi
> 
> Can you try running it outside ActiveMQ eg from camel:run. To see that it
> works. Then we can identify the problem with ActiveMQ later.
> 
> I have added a unit test to camel-spring that works with your
> configuration.
> It gets the DeadLetterChannel that is configured as a spring bean and uses
> the redelivery prorperties as well.
> 
> 
> 
> Med venlig hilsen
>  
> Claus Ibsen
> ......................................
> Silverbullet
> Skovsgårdsvænget 21
> 8362 Hørning
> Tlf. +45 2962 7576
> Web: www.silverbullet.dk
> 
> -----Original Message-----
> From: vguna [mailto:grave@gmx.de] 
> Sent: 7. juli 2008 13:49
> To: camel-user@activemq.apache.org
> Subject: RE: spring DeadLetterChannel redelivery config
> 
> 
> Hi again.
> 
> I recently encountered that the redeliveryPolicy still doesn't work as
> expected. Basically it does the redelivery - but with default settings as
> it
> seems.
> 
> Tried this configuration in activemq.xml with camel 1.4 snapshot:
> 
>     <camelContext id="camel"
> xmlns="http://activemq.apache.org/camel/schema/spring">
> 
>         <route errorHandlerRef="deadLetterErrorHandler">
>                 <from uri="activemq:NEW" />
>         </route>
>     </camelContext>
> 
> <bean id="deadLetterErrorHandler"
> class="org.apache.camel.builder.DeadLetterChannelBuilder">
>     <property name="redeliveryPolicy" ref="redeliveryPolicyConfig"/>
> </bean>
> 
> <bean id="redeliveryPolicyConfig"
> class="org.apache.camel.processor.RedeliveryPolicy">
>     <property name="maximumRedeliveries" value="3"/>
>     <property name="initialRedeliveryDelay" value="10000"/>
>     <property name="useExponentialBackOff" value="true"/>
>     <property name="backOffMultiplier" value="2" />
> </bean>
> 
> Redelivery takes place in 30 seconds with a retry count of 5 instead of
> the
> values configured. This might be because the errorHandlerRef on route
> isn't
> evaluated at all. If I change this to foobar, it doesn't complain about it
> on startup.
> 
> So what I'm doing wrong?
> 
> Regards,
> Veit
> 
> 
> 
> 
> Claus Ibsen wrote:
>> 
>> Hi
>> 
>> Thanks a lot for sharing this. Handy for others as well.
>> There could be an issue with the initial delay vs. repated delay.
>> 
>> Do you mind creating a JIRA ticket for this - then its not forgotten.
>> Would be nice with a special delay for the first redelivery and then
>> another setting for the repeated delay. 
>> 
>> 
>> Med venlig hilsen
>>  
>> Claus Ibsen
>> ......................................
>> Silverbullet
>> Skovsgårdsvænget 21
>> 8362 Hørning
>> Tlf. +45 2962 7576
>> Web: www.silverbullet.dk
>> 
>> -----Original Message-----
>> From: vguna [mailto:grave@gmx.de] 
>> Sent: 7. juli 2008 11:17
>> To: camel-user@activemq.apache.org
>> Subject: Re: spring DeadLetterChannel redelivery config
>> 
>> 
>> Hi James.
>> 
>> Thanks for the reply. It seems to work now. For all, who asking
>> themselves
>> how a xml configuration for this will look like, here's an example:
>> 
>>     <camelContext id="camel"
>> xmlns="http://activemq.apache.org/camel/schema/spring">
>> 
>>         <route errorHandlerRef="deadLetterErrorHandler">
>>                 <from uri="activemq:NEW" />
>>         </route>
>> 
>>     </camelContext>
>> 
>> <bean id="deadLetterErrorHandler"
>> class="org.apache.camel.builder.DeadLetterChannelBuilder">
>>     <property name="redeliveryPolicy" ref="redeliveryPolicyConfig"/>
>> </bean>
>> 
>> <bean id="redeliveryPolicyConfig"
>> class="org.apache.camel.processor.RedeliveryPolicy">
>>     <property name="maximumRedeliveries" value="4"/>
>>     <property name="initialRedeliveryDelay" value="30000"/>
>>     <property name="useExponentialBackOff" value="true"/>
>> </bean>
>> 
>> 
>> Still one problem left. When an error occurs, a redelivery is executed
>> immediately - without the specified delay. After
>> that, the redeliveryDelay is used correctly.Is this by design? Would be
>> nice, if one could configure a "redeliveryDelay" and a
>> "initialRedliveryDelay". Or just simply use the delay on the first
>> redelivery attempt, too.
>> 
>> Regards,
>> Veit
>> 
>> 
>> 
>> 
>> 
>> James.Strachan wrote:
>>> 
>>> I've recently fixed this...
>>> 
>>> https://issues.apache.org/activemq/browse/CAMEL-662
>>> 
>>> so you can now specify an errorHandlerRef on a <camelContext> a
>>> <route> or <pipeline> element to refer to a spring bean which could be
>>> a DeadLetterChannelBuilder or a TransactionalErrorHandlerBuilder etc.
>>> 
>>> i.e. you can define the errror handler as a normal spring bean now
>>> 
>>> 2008/3/7 Marc Giger <gi...@gmx.ch>:
>>>> Hi,
>>>>
>>>> I'm trying to configure the DeadLetterChannel with spring.
>>>> Unfortunately without success. No matter where I declare the
>>>> <onException>, camel tries to redeliver the message 5 times in the case
>>>> of an exception.
>>>>
>>>> How must the following configuration be modified so that camel just
>>>> tries to deliver once?
>>>>
>>>> <camelContext id="camel"
>>>> xmlns="http://activemq.apache.org/camel/schema/spring">
>>>> <route>
>>>>            <from uri="cxf:bean:routerEndpoint"/>
>>>>            <onException> <!-- no effect -->
>>>>                <redeliveryPolicy>
>>>>                    <maximumRedeliveries>0</maximumRedeliveries>
>>>>                </redeliveryPolicy>
>>>>            </onException>
>>>>            <process ref="decryptProcessor">
>>>>                <onException> <!-- no effect -->
>>>>                    <redeliveryPolicy>
>>>>                        <maximumRedeliveries>0</maximumRedeliveries>
>>>>                    </redeliveryPolicy>
>>>>                </onException>
>>>>            </process>
>>>>            <choice>
>>>>                <when>
>>>>                    <methodCall bean="endpointSelector"
>>>> method="matches"/> <to
>>>> uri="cxf:bean:serviceEndpoint?dataFormat=MESSAGE"/> </when>
>>>>                <otherwise>
>>>>                    <to
>>>> uri="cxf:bean:localEndpoint"/> </otherwise>
>>>>            </choice>
>>>>        </route>
>>>>    </camelContext>
>>>>
>>>> Thanks a lot!
>>>>
>>>> Cheers,
>>>>
>>>> Marc
>>>>
>>> 
>>> 
>>> 
>>> -- 
>>> James
>>> -------
>>> http://macstrac.blogspot.com/
>>> 
>>> Open Source Integration
>>> http://open.iona.com
>>> 
>>> 
>> 
>> -- 
>> View this message in context:
>> http://www.nabble.com/spring-DeadLetterChannel-redelivery-config-tp15906561s22882p18312842.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>> 
>> 
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/spring-DeadLetterChannel-redelivery-config-tp15906561s22882p18314952.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/spring-DeadLetterChannel-redelivery-config-tp15906561s22882p18317673.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RE: spring DeadLetterChannel redelivery config

Posted by vguna <gr...@gmx.de>.
Hi.

Ehhw. I'm afraid I'm not too deep into camel yet. camel:run means that it is
a maven target on the source distribution
of camel? I can try that of course...



Claus Ibsen wrote:
> 
> Hi
> 
> Can you try running it outside ActiveMQ eg from camel:run. To see that it
> works. Then we can identify the problem with ActiveMQ later.
> 
> I have added a unit test to camel-spring that works with your
> configuration.
> It gets the DeadLetterChannel that is configured as a spring bean and uses
> the redelivery prorperties as well.
> 
> 
> 
> Med venlig hilsen
>  
> Claus Ibsen
> ......................................
> Silverbullet
> Skovsgårdsvænget 21
> 8362 Hørning
> Tlf. +45 2962 7576
> Web: www.silverbullet.dk
> 
> -----Original Message-----
> From: vguna [mailto:grave@gmx.de] 
> Sent: 7. juli 2008 13:49
> To: camel-user@activemq.apache.org
> Subject: RE: spring DeadLetterChannel redelivery config
> 
> 
> Hi again.
> 
> I recently encountered that the redeliveryPolicy still doesn't work as
> expected. Basically it does the redelivery - but with default settings as
> it
> seems.
> 
> Tried this configuration in activemq.xml with camel 1.4 snapshot:
> 
>     <camelContext id="camel"
> xmlns="http://activemq.apache.org/camel/schema/spring">
> 
>         <route errorHandlerRef="deadLetterErrorHandler">
>                 <from uri="activemq:NEW" />
>         </route>
>     </camelContext>
> 
> <bean id="deadLetterErrorHandler"
> class="org.apache.camel.builder.DeadLetterChannelBuilder">
>     <property name="redeliveryPolicy" ref="redeliveryPolicyConfig"/>
> </bean>
> 
> <bean id="redeliveryPolicyConfig"
> class="org.apache.camel.processor.RedeliveryPolicy">
>     <property name="maximumRedeliveries" value="3"/>
>     <property name="initialRedeliveryDelay" value="10000"/>
>     <property name="useExponentialBackOff" value="true"/>
>     <property name="backOffMultiplier" value="2" />
> </bean>
> 
> Redelivery takes place in 30 seconds with a retry count of 5 instead of
> the
> values configured. This might be because the errorHandlerRef on route
> isn't
> evaluated at all. If I change this to foobar, it doesn't complain about it
> on startup.
> 
> So what I'm doing wrong?
> 
> Regards,
> Veit
> 
> 
> 
> 
> Claus Ibsen wrote:
>> 
>> Hi
>> 
>> Thanks a lot for sharing this. Handy for others as well.
>> There could be an issue with the initial delay vs. repated delay.
>> 
>> Do you mind creating a JIRA ticket for this - then its not forgotten.
>> Would be nice with a special delay for the first redelivery and then
>> another setting for the repeated delay. 
>> 
>> 
>> Med venlig hilsen
>>  
>> Claus Ibsen
>> ......................................
>> Silverbullet
>> Skovsgårdsvænget 21
>> 8362 Hørning
>> Tlf. +45 2962 7576
>> Web: www.silverbullet.dk
>> 
>> -----Original Message-----
>> From: vguna [mailto:grave@gmx.de] 
>> Sent: 7. juli 2008 11:17
>> To: camel-user@activemq.apache.org
>> Subject: Re: spring DeadLetterChannel redelivery config
>> 
>> 
>> Hi James.
>> 
>> Thanks for the reply. It seems to work now. For all, who asking
>> themselves
>> how a xml configuration for this will look like, here's an example:
>> 
>>     <camelContext id="camel"
>> xmlns="http://activemq.apache.org/camel/schema/spring">
>> 
>>         <route errorHandlerRef="deadLetterErrorHandler">
>>                 <from uri="activemq:NEW" />
>>         </route>
>> 
>>     </camelContext>
>> 
>> <bean id="deadLetterErrorHandler"
>> class="org.apache.camel.builder.DeadLetterChannelBuilder">
>>     <property name="redeliveryPolicy" ref="redeliveryPolicyConfig"/>
>> </bean>
>> 
>> <bean id="redeliveryPolicyConfig"
>> class="org.apache.camel.processor.RedeliveryPolicy">
>>     <property name="maximumRedeliveries" value="4"/>
>>     <property name="initialRedeliveryDelay" value="30000"/>
>>     <property name="useExponentialBackOff" value="true"/>
>> </bean>
>> 
>> 
>> Still one problem left. When an error occurs, a redelivery is executed
>> immediately - without the specified delay. After
>> that, the redeliveryDelay is used correctly.Is this by design? Would be
>> nice, if one could configure a "redeliveryDelay" and a
>> "initialRedliveryDelay". Or just simply use the delay on the first
>> redelivery attempt, too.
>> 
>> Regards,
>> Veit
>> 
>> 
>> 
>> 
>> 
>> James.Strachan wrote:
>>> 
>>> I've recently fixed this...
>>> 
>>> https://issues.apache.org/activemq/browse/CAMEL-662
>>> 
>>> so you can now specify an errorHandlerRef on a <camelContext> a
>>> <route> or <pipeline> element to refer to a spring bean which could be
>>> a DeadLetterChannelBuilder or a TransactionalErrorHandlerBuilder etc.
>>> 
>>> i.e. you can define the errror handler as a normal spring bean now
>>> 
>>> 2008/3/7 Marc Giger <gi...@gmx.ch>:
>>>> Hi,
>>>>
>>>> I'm trying to configure the DeadLetterChannel with spring.
>>>> Unfortunately without success. No matter where I declare the
>>>> <onException>, camel tries to redeliver the message 5 times in the case
>>>> of an exception.
>>>>
>>>> How must the following configuration be modified so that camel just
>>>> tries to deliver once?
>>>>
>>>> <camelContext id="camel"
>>>> xmlns="http://activemq.apache.org/camel/schema/spring">
>>>> <route>
>>>>            <from uri="cxf:bean:routerEndpoint"/>
>>>>            <onException> <!-- no effect -->
>>>>                <redeliveryPolicy>
>>>>                    <maximumRedeliveries>0</maximumRedeliveries>
>>>>                </redeliveryPolicy>
>>>>            </onException>
>>>>            <process ref="decryptProcessor">
>>>>                <onException> <!-- no effect -->
>>>>                    <redeliveryPolicy>
>>>>                        <maximumRedeliveries>0</maximumRedeliveries>
>>>>                    </redeliveryPolicy>
>>>>                </onException>
>>>>            </process>
>>>>            <choice>
>>>>                <when>
>>>>                    <methodCall bean="endpointSelector"
>>>> method="matches"/> <to
>>>> uri="cxf:bean:serviceEndpoint?dataFormat=MESSAGE"/> </when>
>>>>                <otherwise>
>>>>                    <to
>>>> uri="cxf:bean:localEndpoint"/> </otherwise>
>>>>            </choice>
>>>>        </route>
>>>>    </camelContext>
>>>>
>>>> Thanks a lot!
>>>>
>>>> Cheers,
>>>>
>>>> Marc
>>>>
>>> 
>>> 
>>> 
>>> -- 
>>> James
>>> -------
>>> http://macstrac.blogspot.com/
>>> 
>>> Open Source Integration
>>> http://open.iona.com
>>> 
>>> 
>> 
>> -- 
>> View this message in context:
>> http://www.nabble.com/spring-DeadLetterChannel-redelivery-config-tp15906561s22882p18312842.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>> 
>> 
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/spring-DeadLetterChannel-redelivery-config-tp15906561s22882p18314952.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/spring-DeadLetterChannel-redelivery-config-tp15906561s22882p18317673.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RE: spring DeadLetterChannel redelivery config

Posted by Claus Ibsen <ci...@silverbullet.dk>.
Hi

Can you try running it outside ActiveMQ eg from camel:run. To see that it works. Then we can identify the problem with ActiveMQ later.

I have added a unit test to camel-spring that works with your configuration.
It gets the DeadLetterChannel that is configured as a spring bean and uses the redelivery prorperties as well.



Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: vguna [mailto:grave@gmx.de] 
Sent: 7. juli 2008 13:49
To: camel-user@activemq.apache.org
Subject: RE: spring DeadLetterChannel redelivery config


Hi again.

I recently encountered that the redeliveryPolicy still doesn't work as
expected. Basically it does the redelivery - but with default settings as it
seems.

Tried this configuration in activemq.xml with camel 1.4 snapshot:

    <camelContext id="camel"
xmlns="http://activemq.apache.org/camel/schema/spring">

        <route errorHandlerRef="deadLetterErrorHandler">
                <from uri="activemq:NEW" />
        </route>
    </camelContext>

<bean id="deadLetterErrorHandler"
class="org.apache.camel.builder.DeadLetterChannelBuilder">
    <property name="redeliveryPolicy" ref="redeliveryPolicyConfig"/>
</bean>

<bean id="redeliveryPolicyConfig"
class="org.apache.camel.processor.RedeliveryPolicy">
    <property name="maximumRedeliveries" value="3"/>
    <property name="initialRedeliveryDelay" value="10000"/>
    <property name="useExponentialBackOff" value="true"/>
    <property name="backOffMultiplier" value="2" />
</bean>

Redelivery takes place in 30 seconds with a retry count of 5 instead of the
values configured. This might be because the errorHandlerRef on route isn't
evaluated at all. If I change this to foobar, it doesn't complain about it
on startup.

So what I'm doing wrong?

Regards,
Veit




Claus Ibsen wrote:
> 
> Hi
> 
> Thanks a lot for sharing this. Handy for others as well.
> There could be an issue with the initial delay vs. repated delay.
> 
> Do you mind creating a JIRA ticket for this - then its not forgotten.
> Would be nice with a special delay for the first redelivery and then
> another setting for the repeated delay. 
> 
> 
> Med venlig hilsen
>  
> Claus Ibsen
> ......................................
> Silverbullet
> Skovsgårdsvænget 21
> 8362 Hørning
> Tlf. +45 2962 7576
> Web: www.silverbullet.dk
> 
> -----Original Message-----
> From: vguna [mailto:grave@gmx.de] 
> Sent: 7. juli 2008 11:17
> To: camel-user@activemq.apache.org
> Subject: Re: spring DeadLetterChannel redelivery config
> 
> 
> Hi James.
> 
> Thanks for the reply. It seems to work now. For all, who asking themselves
> how a xml configuration for this will look like, here's an example:
> 
>     <camelContext id="camel"
> xmlns="http://activemq.apache.org/camel/schema/spring">
> 
>         <route errorHandlerRef="deadLetterErrorHandler">
>                 <from uri="activemq:NEW" />
>         </route>
> 
>     </camelContext>
> 
> <bean id="deadLetterErrorHandler"
> class="org.apache.camel.builder.DeadLetterChannelBuilder">
>     <property name="redeliveryPolicy" ref="redeliveryPolicyConfig"/>
> </bean>
> 
> <bean id="redeliveryPolicyConfig"
> class="org.apache.camel.processor.RedeliveryPolicy">
>     <property name="maximumRedeliveries" value="4"/>
>     <property name="initialRedeliveryDelay" value="30000"/>
>     <property name="useExponentialBackOff" value="true"/>
> </bean>
> 
> 
> Still one problem left. When an error occurs, a redelivery is executed
> immediately - without the specified delay. After
> that, the redeliveryDelay is used correctly.Is this by design? Would be
> nice, if one could configure a "redeliveryDelay" and a
> "initialRedliveryDelay". Or just simply use the delay on the first
> redelivery attempt, too.
> 
> Regards,
> Veit
> 
> 
> 
> 
> 
> James.Strachan wrote:
>> 
>> I've recently fixed this...
>> 
>> https://issues.apache.org/activemq/browse/CAMEL-662
>> 
>> so you can now specify an errorHandlerRef on a <camelContext> a
>> <route> or <pipeline> element to refer to a spring bean which could be
>> a DeadLetterChannelBuilder or a TransactionalErrorHandlerBuilder etc.
>> 
>> i.e. you can define the errror handler as a normal spring bean now
>> 
>> 2008/3/7 Marc Giger <gi...@gmx.ch>:
>>> Hi,
>>>
>>> I'm trying to configure the DeadLetterChannel with spring.
>>> Unfortunately without success. No matter where I declare the
>>> <onException>, camel tries to redeliver the message 5 times in the case
>>> of an exception.
>>>
>>> How must the following configuration be modified so that camel just
>>> tries to deliver once?
>>>
>>> <camelContext id="camel"
>>> xmlns="http://activemq.apache.org/camel/schema/spring">
>>> <route>
>>>            <from uri="cxf:bean:routerEndpoint"/>
>>>            <onException> <!-- no effect -->
>>>                <redeliveryPolicy>
>>>                    <maximumRedeliveries>0</maximumRedeliveries>
>>>                </redeliveryPolicy>
>>>            </onException>
>>>            <process ref="decryptProcessor">
>>>                <onException> <!-- no effect -->
>>>                    <redeliveryPolicy>
>>>                        <maximumRedeliveries>0</maximumRedeliveries>
>>>                    </redeliveryPolicy>
>>>                </onException>
>>>            </process>
>>>            <choice>
>>>                <when>
>>>                    <methodCall bean="endpointSelector"
>>> method="matches"/> <to
>>> uri="cxf:bean:serviceEndpoint?dataFormat=MESSAGE"/> </when>
>>>                <otherwise>
>>>                    <to
>>> uri="cxf:bean:localEndpoint"/> </otherwise>
>>>            </choice>
>>>        </route>
>>>    </camelContext>
>>>
>>> Thanks a lot!
>>>
>>> Cheers,
>>>
>>> Marc
>>>
>> 
>> 
>> 
>> -- 
>> James
>> -------
>> http://macstrac.blogspot.com/
>> 
>> Open Source Integration
>> http://open.iona.com
>> 
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/spring-DeadLetterChannel-redelivery-config-tp15906561s22882p18312842.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/spring-DeadLetterChannel-redelivery-config-tp15906561s22882p18314952.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RE: spring DeadLetterChannel redelivery config

Posted by vguna <gr...@gmx.de>.
Hi again.

I recently encountered that the redeliveryPolicy still doesn't work as
expected. Basically it does the redelivery - but with default settings as it
seems.

Tried this configuration in activemq.xml with camel 1.4 snapshot:

    <camelContext id="camel"
xmlns="http://activemq.apache.org/camel/schema/spring">

        <route errorHandlerRef="deadLetterErrorHandler">
                <from uri="activemq:NEW" />
        </route>
    </camelContext>

<bean id="deadLetterErrorHandler"
class="org.apache.camel.builder.DeadLetterChannelBuilder">
    <property name="redeliveryPolicy" ref="redeliveryPolicyConfig"/>
</bean>

<bean id="redeliveryPolicyConfig"
class="org.apache.camel.processor.RedeliveryPolicy">
    <property name="maximumRedeliveries" value="3"/>
    <property name="initialRedeliveryDelay" value="10000"/>
    <property name="useExponentialBackOff" value="true"/>
    <property name="backOffMultiplier" value="2" />
</bean>

Redelivery takes place in 30 seconds with a retry count of 5 instead of the
values configured. This might be because the errorHandlerRef on route isn't
evaluated at all. If I change this to foobar, it doesn't complain about it
on startup.

So what I'm doing wrong?

Regards,
Veit




Claus Ibsen wrote:
> 
> Hi
> 
> Thanks a lot for sharing this. Handy for others as well.
> There could be an issue with the initial delay vs. repated delay.
> 
> Do you mind creating a JIRA ticket for this - then its not forgotten.
> Would be nice with a special delay for the first redelivery and then
> another setting for the repeated delay. 
> 
> 
> Med venlig hilsen
>  
> Claus Ibsen
> ......................................
> Silverbullet
> Skovsgårdsvænget 21
> 8362 Hørning
> Tlf. +45 2962 7576
> Web: www.silverbullet.dk
> 
> -----Original Message-----
> From: vguna [mailto:grave@gmx.de] 
> Sent: 7. juli 2008 11:17
> To: camel-user@activemq.apache.org
> Subject: Re: spring DeadLetterChannel redelivery config
> 
> 
> Hi James.
> 
> Thanks for the reply. It seems to work now. For all, who asking themselves
> how a xml configuration for this will look like, here's an example:
> 
>     <camelContext id="camel"
> xmlns="http://activemq.apache.org/camel/schema/spring">
> 
>         <route errorHandlerRef="deadLetterErrorHandler">
>                 <from uri="activemq:NEW" />
>         </route>
> 
>     </camelContext>
> 
> <bean id="deadLetterErrorHandler"
> class="org.apache.camel.builder.DeadLetterChannelBuilder">
>     <property name="redeliveryPolicy" ref="redeliveryPolicyConfig"/>
> </bean>
> 
> <bean id="redeliveryPolicyConfig"
> class="org.apache.camel.processor.RedeliveryPolicy">
>     <property name="maximumRedeliveries" value="4"/>
>     <property name="initialRedeliveryDelay" value="30000"/>
>     <property name="useExponentialBackOff" value="true"/>
> </bean>
> 
> 
> Still one problem left. When an error occurs, a redelivery is executed
> immediately - without the specified delay. After
> that, the redeliveryDelay is used correctly.Is this by design? Would be
> nice, if one could configure a "redeliveryDelay" and a
> "initialRedliveryDelay". Or just simply use the delay on the first
> redelivery attempt, too.
> 
> Regards,
> Veit
> 
> 
> 
> 
> 
> James.Strachan wrote:
>> 
>> I've recently fixed this...
>> 
>> https://issues.apache.org/activemq/browse/CAMEL-662
>> 
>> so you can now specify an errorHandlerRef on a <camelContext> a
>> <route> or <pipeline> element to refer to a spring bean which could be
>> a DeadLetterChannelBuilder or a TransactionalErrorHandlerBuilder etc.
>> 
>> i.e. you can define the errror handler as a normal spring bean now
>> 
>> 2008/3/7 Marc Giger <gi...@gmx.ch>:
>>> Hi,
>>>
>>> I'm trying to configure the DeadLetterChannel with spring.
>>> Unfortunately without success. No matter where I declare the
>>> <onException>, camel tries to redeliver the message 5 times in the case
>>> of an exception.
>>>
>>> How must the following configuration be modified so that camel just
>>> tries to deliver once?
>>>
>>> <camelContext id="camel"
>>> xmlns="http://activemq.apache.org/camel/schema/spring">
>>> <route>
>>>            <from uri="cxf:bean:routerEndpoint"/>
>>>            <onException> <!-- no effect -->
>>>                <redeliveryPolicy>
>>>                    <maximumRedeliveries>0</maximumRedeliveries>
>>>                </redeliveryPolicy>
>>>            </onException>
>>>            <process ref="decryptProcessor">
>>>                <onException> <!-- no effect -->
>>>                    <redeliveryPolicy>
>>>                        <maximumRedeliveries>0</maximumRedeliveries>
>>>                    </redeliveryPolicy>
>>>                </onException>
>>>            </process>
>>>            <choice>
>>>                <when>
>>>                    <methodCall bean="endpointSelector"
>>> method="matches"/> <to
>>> uri="cxf:bean:serviceEndpoint?dataFormat=MESSAGE"/> </when>
>>>                <otherwise>
>>>                    <to
>>> uri="cxf:bean:localEndpoint"/> </otherwise>
>>>            </choice>
>>>        </route>
>>>    </camelContext>
>>>
>>> Thanks a lot!
>>>
>>> Cheers,
>>>
>>> Marc
>>>
>> 
>> 
>> 
>> -- 
>> James
>> -------
>> http://macstrac.blogspot.com/
>> 
>> Open Source Integration
>> http://open.iona.com
>> 
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/spring-DeadLetterChannel-redelivery-config-tp15906561s22882p18312842.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/spring-DeadLetterChannel-redelivery-config-tp15906561s22882p18314952.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RE: spring DeadLetterChannel redelivery config

Posted by Claus Ibsen <ci...@silverbullet.dk>.
Hi

Thanks a lot for sharing this. Handy for others as well.
There could be an issue with the initial delay vs. repated delay.

Do you mind creating a JIRA ticket for this - then its not forgotten.
Would be nice with a special delay for the first redelivery and then another setting for the repeated delay. 


Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: vguna [mailto:grave@gmx.de] 
Sent: 7. juli 2008 11:17
To: camel-user@activemq.apache.org
Subject: Re: spring DeadLetterChannel redelivery config


Hi James.

Thanks for the reply. It seems to work now. For all, who asking themselves
how a xml configuration for this will look like, here's an example:

    <camelContext id="camel"
xmlns="http://activemq.apache.org/camel/schema/spring">

        <route errorHandlerRef="deadLetterErrorHandler">
                <from uri="activemq:NEW" />
        </route>

    </camelContext>

<bean id="deadLetterErrorHandler"
class="org.apache.camel.builder.DeadLetterChannelBuilder">
    <property name="redeliveryPolicy" ref="redeliveryPolicyConfig"/>
</bean>

<bean id="redeliveryPolicyConfig"
class="org.apache.camel.processor.RedeliveryPolicy">
    <property name="maximumRedeliveries" value="4"/>
    <property name="initialRedeliveryDelay" value="30000"/>
    <property name="useExponentialBackOff" value="true"/>
</bean>


Still one problem left. When an error occurs, a redelivery is executed
immediately - without the specified delay. After
that, the redeliveryDelay is used correctly.Is this by design? Would be
nice, if one could configure a "redeliveryDelay" and a
"initialRedliveryDelay". Or just simply use the delay on the first
redelivery attempt, too.

Regards,
Veit





James.Strachan wrote:
> 
> I've recently fixed this...
> 
> https://issues.apache.org/activemq/browse/CAMEL-662
> 
> so you can now specify an errorHandlerRef on a <camelContext> a
> <route> or <pipeline> element to refer to a spring bean which could be
> a DeadLetterChannelBuilder or a TransactionalErrorHandlerBuilder etc.
> 
> i.e. you can define the errror handler as a normal spring bean now
> 
> 2008/3/7 Marc Giger <gi...@gmx.ch>:
>> Hi,
>>
>> I'm trying to configure the DeadLetterChannel with spring.
>> Unfortunately without success. No matter where I declare the
>> <onException>, camel tries to redeliver the message 5 times in the case
>> of an exception.
>>
>> How must the following configuration be modified so that camel just
>> tries to deliver once?
>>
>> <camelContext id="camel"
>> xmlns="http://activemq.apache.org/camel/schema/spring">
>> <route>
>>            <from uri="cxf:bean:routerEndpoint"/>
>>            <onException> <!-- no effect -->
>>                <redeliveryPolicy>
>>                    <maximumRedeliveries>0</maximumRedeliveries>
>>                </redeliveryPolicy>
>>            </onException>
>>            <process ref="decryptProcessor">
>>                <onException> <!-- no effect -->
>>                    <redeliveryPolicy>
>>                        <maximumRedeliveries>0</maximumRedeliveries>
>>                    </redeliveryPolicy>
>>                </onException>
>>            </process>
>>            <choice>
>>                <when>
>>                    <methodCall bean="endpointSelector"
>> method="matches"/> <to
>> uri="cxf:bean:serviceEndpoint?dataFormat=MESSAGE"/> </when>
>>                <otherwise>
>>                    <to
>> uri="cxf:bean:localEndpoint"/> </otherwise>
>>            </choice>
>>        </route>
>>    </camelContext>
>>
>> Thanks a lot!
>>
>> Cheers,
>>
>> Marc
>>
> 
> 
> 
> -- 
> James
> -------
> http://macstrac.blogspot.com/
> 
> Open Source Integration
> http://open.iona.com
> 
> 

-- 
View this message in context: http://www.nabble.com/spring-DeadLetterChannel-redelivery-config-tp15906561s22882p18312842.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: spring DeadLetterChannel redelivery config

Posted by vguna <gr...@gmx.de>.
Hi James.

Thanks for the reply. It seems to work now. For all, who asking themselves
how a xml configuration for this will look like, here's an example:

    <camelContext id="camel"
xmlns="http://activemq.apache.org/camel/schema/spring">

        <route errorHandlerRef="deadLetterErrorHandler">
                <from uri="activemq:NEW" />
        </route>

    </camelContext>

<bean id="deadLetterErrorHandler"
class="org.apache.camel.builder.DeadLetterChannelBuilder">
    <property name="redeliveryPolicy" ref="redeliveryPolicyConfig"/>
</bean>

<bean id="redeliveryPolicyConfig"
class="org.apache.camel.processor.RedeliveryPolicy">
    <property name="maximumRedeliveries" value="4"/>
    <property name="initialRedeliveryDelay" value="30000"/>
    <property name="useExponentialBackOff" value="true"/>
</bean>


Still one problem left. When an error occurs, a redelivery is executed
immediately - without the specified delay. After
that, the redeliveryDelay is used correctly.Is this by design? Would be
nice, if one could configure a "redeliveryDelay" and a
"initialRedliveryDelay". Or just simply use the delay on the first
redelivery attempt, too.

Regards,
Veit





James.Strachan wrote:
> 
> I've recently fixed this...
> 
> https://issues.apache.org/activemq/browse/CAMEL-662
> 
> so you can now specify an errorHandlerRef on a <camelContext> a
> <route> or <pipeline> element to refer to a spring bean which could be
> a DeadLetterChannelBuilder or a TransactionalErrorHandlerBuilder etc.
> 
> i.e. you can define the errror handler as a normal spring bean now
> 
> 2008/3/7 Marc Giger <gi...@gmx.ch>:
>> Hi,
>>
>> I'm trying to configure the DeadLetterChannel with spring.
>> Unfortunately without success. No matter where I declare the
>> <onException>, camel tries to redeliver the message 5 times in the case
>> of an exception.
>>
>> How must the following configuration be modified so that camel just
>> tries to deliver once?
>>
>> <camelContext id="camel"
>> xmlns="http://activemq.apache.org/camel/schema/spring">
>> <route>
>>            <from uri="cxf:bean:routerEndpoint"/>
>>            <onException> <!-- no effect -->
>>                <redeliveryPolicy>
>>                    <maximumRedeliveries>0</maximumRedeliveries>
>>                </redeliveryPolicy>
>>            </onException>
>>            <process ref="decryptProcessor">
>>                <onException> <!-- no effect -->
>>                    <redeliveryPolicy>
>>                        <maximumRedeliveries>0</maximumRedeliveries>
>>                    </redeliveryPolicy>
>>                </onException>
>>            </process>
>>            <choice>
>>                <when>
>>                    <methodCall bean="endpointSelector"
>> method="matches"/> <to
>> uri="cxf:bean:serviceEndpoint?dataFormat=MESSAGE"/> </when>
>>                <otherwise>
>>                    <to
>> uri="cxf:bean:localEndpoint"/> </otherwise>
>>            </choice>
>>        </route>
>>    </camelContext>
>>
>> Thanks a lot!
>>
>> Cheers,
>>
>> Marc
>>
> 
> 
> 
> -- 
> James
> -------
> http://macstrac.blogspot.com/
> 
> Open Source Integration
> http://open.iona.com
> 
> 

-- 
View this message in context: http://www.nabble.com/spring-DeadLetterChannel-redelivery-config-tp15906561s22882p18312842.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: spring DeadLetterChannel redelivery config

Posted by James Strachan <ja...@gmail.com>.
I've recently fixed this...

https://issues.apache.org/activemq/browse/CAMEL-662

so you can now specify an errorHandlerRef on a <camelContext> a
<route> or <pipeline> element to refer to a spring bean which could be
a DeadLetterChannelBuilder or a TransactionalErrorHandlerBuilder etc.

i.e. you can define the errror handler as a normal spring bean now

2008/3/7 Marc Giger <gi...@gmx.ch>:
> Hi,
>
> I'm trying to configure the DeadLetterChannel with spring.
> Unfortunately without success. No matter where I declare the
> <onException>, camel tries to redeliver the message 5 times in the case
> of an exception.
>
> How must the following configuration be modified so that camel just
> tries to deliver once?
>
> <camelContext id="camel"
> xmlns="http://activemq.apache.org/camel/schema/spring">
> <route>
>            <from uri="cxf:bean:routerEndpoint"/>
>            <onException> <!-- no effect -->
>                <redeliveryPolicy>
>                    <maximumRedeliveries>0</maximumRedeliveries>
>                </redeliveryPolicy>
>            </onException>
>            <process ref="decryptProcessor">
>                <onException> <!-- no effect -->
>                    <redeliveryPolicy>
>                        <maximumRedeliveries>0</maximumRedeliveries>
>                    </redeliveryPolicy>
>                </onException>
>            </process>
>            <choice>
>                <when>
>                    <methodCall bean="endpointSelector"
> method="matches"/> <to
> uri="cxf:bean:serviceEndpoint?dataFormat=MESSAGE"/> </when>
>                <otherwise>
>                    <to
> uri="cxf:bean:localEndpoint"/> </otherwise>
>            </choice>
>        </route>
>    </camelContext>
>
> Thanks a lot!
>
> Cheers,
>
> Marc
>



-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com

Re: spring DeadLetterChannel redelivery config

Posted by vguna <gr...@gmx.de>.
Hi.

Here's the same problem with this configuration:

    	<route>
    		<from uri="activemq:NEW" />
    	    <onException>   	         
    	        <redeliveryPolicy>
    	            <maximumRedeliveries>4</maximumRedeliveries>    	            
    	            <initialRedeliveryDelay>30000</initialRedeliveryDelay>
    	            <useExponentialBackOff>true</useExponentialBackOff>   	            
    	        </redeliveryPolicy>
    	    </onException>
    	</route>

It just happens nothing when an exception on the onMessage method is thrown.
Means: 5 retries in a delay of 1 second, after that it will be put in the
DLQ.

Maybe spring configuration is broken? Didn't try the DSL yet. Don't want to
code anything for this configuration settings.

Any hints?
Veit



Marc Giger wrote:
> 
> Hi,
> 
> I'm trying to configure the DeadLetterChannel with spring.
> Unfortunately without success. No matter where I declare the
> <onException>, camel tries to redeliver the message 5 times in the case
> of an exception.
> 
> How must the following configuration be modified so that camel just
> tries to deliver once?
> 
> <camelContext id="camel"
> xmlns="http://activemq.apache.org/camel/schema/spring">
> <route> 
>             <from uri="cxf:bean:routerEndpoint"/>
>             <onException> <!-- no effect -->
>                 <redeliveryPolicy>
>                     <maximumRedeliveries>0</maximumRedeliveries>
>                 </redeliveryPolicy>
>             </onException>
>             <process ref="decryptProcessor">
>                 <onException> <!-- no effect -->
>                     <redeliveryPolicy>
>                         <maximumRedeliveries>0</maximumRedeliveries>
>                     </redeliveryPolicy>
>                 </onException>
>             </process>
>             <choice>
>                 <when>
>                     <methodCall bean="endpointSelector"
> method="matches"/> <to
> uri="cxf:bean:serviceEndpoint?dataFormat=MESSAGE"/> </when>
>                 <otherwise>
>                     <to
> uri="cxf:bean:localEndpoint"/> </otherwise>
>             </choice>            
>         </route>
>     </camelContext>
> 
> Thanks a lot!
> 
> Cheers,
> 
> Marc
> 
> 

-- 
View this message in context: http://www.nabble.com/spring-DeadLetterChannel-redelivery-config-tp15906561s22882p18278925.html
Sent from the Camel - Users mailing list archive at Nabble.com.