camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Patrick Valsecchi <patrick.valsec...@camptocamp.com>
Subject Re: Redelivery per Endpoint
Date Wed, 10 Feb 2016 12:38:56 GMT
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 <nesprj@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.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message