You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by sarfaraj <sa...@gmail.com> on 2012/08/22 13:38:36 UTC

redeliveryPolicy -: How can we retry from start of the route in case of exception occurred inbetween of route?

Hi,

I observed onException (using redeliveryPolicy) retry particular processor
in which exception occurred. Can it be retry from start ?

like if we have 3 processor doing something (say ...processor 1, processor
2, processor 3)

if exception occurred at processor 2 then it's retrying for processor 2
only.

how do we configure to retry from processor 1 ? 

Any suggestion/thoughts ?

/Sarfaraj



--
View this message in context: http://camel.465427.n5.nabble.com/redeliveryPolicy-How-can-we-retry-from-start-of-the-route-in-case-of-exception-occurred-inbetween-of-tp5717848.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: redeliveryPolicy -: How can we retry from start of the route in case of exception occurred inbetween of route?

Posted by sarfaraj <sa...@gmail.com>.
Hey man it works :) . This is what I exactly wanted. Finally I got it.

Many thanks !!!! appreciated

/Sarfaraj



--
View this message in context: http://camel.465427.n5.nabble.com/redeliveryPolicy-How-can-we-retry-from-start-of-the-route-in-case-of-exception-occurred-inbetween-of-tp5717848p5717935.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: redeliveryPolicy -: How can we retry from start of the route in case of exception occurred inbetween of route?

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

You can use a separate route for the ssh logic, and in that route
disable error handling.
Then Camel will redeliver that route.

I created a FAQ entry with an example
https://cwiki.apache.org/confluence/display/CAMEL/How+do+I+retry+processing+a+message+from+a+certain+point+back+or+an+entire+route

On Thu, Aug 23, 2012 at 8:04 AM, sarfaraj <sa...@gmail.com> wrote:
> Let me ask you specific question.
>
> I have below component in my camel route.
>
>
> *<process ref="prepareSshProcessor" id="sshPrepare" />
> <to uri="ssh://root:xxxxx@myserver.com:22" />
> <process ref="sshResultProcessor" id="sshResult" />*
>
> Once the ssh execute we get the result in "sshResultProcessor"; After that
> on some condition we throws custom exception.
> What happen here only "sshResultProcessor" retries 2 using redeliveryPolicy
> . But we want to retry from ssh.
>
> Can you have any idea, how to do it ?
>
> FYI...here is the onException block
>
> <onException>
>                         <exception>com.exception.MyException
>                         </exception>
>                         <redeliveryPolicy redeliveryDelay="1000"
>                                 maximumRedeliveries="2" retryAttemptedLogLevel="WARN" />
>                         <continued>
>                                 <constant>true</constant>
>                         </continued>
>                         <process ref="exceptionProcessor" id="exceptionHandler" />
>                 </onException>
>
>
> /Sarfaraj
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/redeliveryPolicy-How-can-we-retry-from-start-of-the-route-in-case-of-exception-occurred-inbetween-of-tp5717848p5717912.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: redeliveryPolicy -: How can we retry from start of the route in case of exception occurred inbetween of route?

Posted by sarfaraj <sa...@gmail.com>.
Let me ask you specific question.

I have below component in my camel route.


*<process ref="prepareSshProcessor" id="sshPrepare" />
<to uri="ssh://root:xxxxx@myserver.com:22" />
<process ref="sshResultProcessor" id="sshResult" />*

Once the ssh execute we get the result in "sshResultProcessor"; After that
on some condition we throws custom exception. 
What happen here only "sshResultProcessor" retries 2 using redeliveryPolicy
. But we want to retry from ssh.

Can you have any idea, how to do it ?

FYI...here is the onException block

<onException>
			<exception>com.exception.MyException
			</exception>
			<redeliveryPolicy redeliveryDelay="1000"
				maximumRedeliveries="2" retryAttemptedLogLevel="WARN" />
			<continued>
				<constant>true</constant>
			</continued>
			<process ref="exceptionProcessor" id="exceptionHandler" />
		</onException>


/Sarfaraj



--
View this message in context: http://camel.465427.n5.nabble.com/redeliveryPolicy-How-can-we-retry-from-start-of-the-route-in-case-of-exception-occurred-inbetween-of-tp5717848p5717912.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: redeliveryPolicy -: How can we retry from start of the route in case of exception occurred inbetween of route?

Posted by Claus Ibsen <cl...@gmail.com>.
On Wed, Aug 22, 2012 at 1:38 PM, sarfaraj <sa...@gmail.com> wrote:
> Hi,
>
> I observed onException (using redeliveryPolicy) retry particular processor
> in which exception occurred. Can it be retry from start ?
>
> like if we have 3 processor doing something (say ...processor 1, processor
> 2, processor 3)
>
> if exception occurred at processor 2 then it's retrying for processor 2
> only.
>
> how do we configure to retry from processor 1 ?
>
> Any suggestion/thoughts ?
>

This is by design to retry at the point of failure.

If you want to start all over then if you use JMS etc as input, you
can use transaction, and have the JMS broker redeliver the message to
Camel again.

An alternative in Camel is to use a DeadLetterChannel error handler,
and send the message into the route again using a seda endpoint or
something. Mind about endless looping if the error occurs all the
time.
And you would need to enable the use original message option.
This has been talked about before on this @user forum, you may find
the thread with code samples.

> /Sarfaraj
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/redeliveryPolicy-How-can-we-retry-from-start-of-the-route-in-case-of-exception-occurred-inbetween-of-tp5717848.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen