Hi

If you want to retry an entire route, you can mark the route with no
error handler, and call it from another route with direct, then the
redelivery will start again from the beginning of the route (eg it
redelivers the direct call)

An unit test is here
https://github.com/apache/camel/commit/8406bc3e1671d546f8fdc988a19760f45f5e6529


On Wed, Feb 10, 2016 at 1:38 PM, Patrick Valsecchi
<patrick.valsec...@camptocamp.com> wrote:
> Hi,
>
> I had to implement some retry logic using camel as well, tried a lot of
> different tricks but always failed.
>
> I needed to be able to send a HTTP POST, then poll an URL (using exception
> and redelivery). I case of error (other than my polling) I wanted to be
> able to re-send my HTTP POST. But the retries where eating at the number of
> redeliveries of my POST.
>
> My solution? I've developed a new camel component to do the retries without
> relying on Camel exception handlers:
> https://github.com/pvalsecc/camel-retry
>
> Example of route:
> https://github.com/pvalsecc/camel-retry/blob/master/src/test/java/ch/thus/camel/retry/RetryDefaultTest.java#L100-L101
>
> CU
>
> On Wed, Feb 10, 2016 at 3:08 AM, NES <nes...@gmail.com> wrote:
>
>> Thanks Quinn.
>> I would like to clarify again.
>>
>> If I want to send other servers the messages that sending message was
>> success on each sending, and to set retry options on them as well, I have
>> to
>> nest direct routes?
>>
>> <route>
>>     <from uri="direct://my-http"/>
>>     <onException>
>>         <exception>java.lang.Exception</exception>
>>         <redeliveryPolicy maximumRedeliveries="1" redeliveryDelay="1000"/>
>>     </onException>
>>     <to uri="http4://127.0.0.1:80/bar..."/>
>>     <setBody>
>>         <constant>Http Success</constant>
>>     </setBody>
>>     <to uri="direct:httpSuccess" />
>> </route>
>>
>> <route>
>>     <from uri="direct://httpSuccess"/>
>>     <onException>
>>         <exception>java.lang.Exception</exception>
>>         <redeliveryPolicy maximumRedeliveries="3" redeliveryDelay="3000"/>
>>     </onException>
>>     <to uri="http4://127.0.0.1:80/httpsuccess..."/>
>> </route>
>>
>> <route>
>>     <from uri="direct://my-sql"/>
>>     <onException>
>>         <exception>java.lang.Exception</exception>
>>         <redeliveryPolicy maximumRedeliveries="10"
>> redeliveryDelay="10000"/>
>>     </onException>
>>     <to uri="sql:INSERT INTO BAZ_TBL (NAME) VALUES(:#${body})..."/>
>>     <setBody>
>>         <constant>SQL Success</constant>
>>     </setBody>
>>     <to uri="direct:sqlSuccess" />
>> </route>
>>
>> <route>
>>     <from uri="direct://sqlSuccess"/>
>>     <onException>
>>         <exception>java.lang.Exception</exception>
>>         <redeliveryPolicy maximumRedeliveries="4" redeliveryDelay="4000"/>
>>     </onException>
>>     <to uri="http4://127.0.0.1:80/sqlsuccess..."/>
>> </route>
>>
>> <route>
>>     <from uri="direct://my-activemq"/>
>>     <onException>
>>         <exception>java.lang.Exception</exception>
>>         <redeliveryPolicy maximumRedeliveries="25"
>> redeliveryDelay="25000"/>
>>     </onException>
>>     <to uri="activemq:qux..."/>
>>     <setBody>
>>         <constant>ActiveMQ Success</constant>
>>     </setBody>
>>     <to uri="direct:activemqSuccess" />
>> </route>
>>
>> <route>
>>     <from uri="direct://activemqSuccess"/>
>>     <onException>
>>         <exception>java.lang.Exception</exception>
>>         <redeliveryPolicy maximumRedeliveries="5" redeliveryDelay="5000"/>
>>     </onException>
>>     <to uri="http4://127.0.0.1:80/activemqsuccess..."/>
>> </route>
>>
>> <route>
>>     <from uri="servlet:///foo"/>
>>     <multicast>
>>         <to uri="direct://my-http"/>
>>         <to uri="direct://my-sql"/>
>>         <to uri="direct://my-activemq"/>
>>     </multicast>
>> </route>
>>
>>
>>
>> --
>> View this message in context:
>> http://camel.465427.n5.nabble.com/Redelivery-per-Endpoint-tp5777413p5777501.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Reply via email to