I tried the following approach:

- In my onException processor I set a custom property indicating that the
exchange has failed.
- In my onCompletion processor I regard the exchange as failed if
theExchange.isFailed() OR my custom property is true.

This seems to do the trick. Are there any gaps I haven't thought of?

Thanks for you reply Andreas. I  haven't tried your approach yet but it s a
good idea. Basically I will have to handle the moveFailed myself but it
seems pretty easy looking at your example.

/Bengt

2010/11/26 Andreas A. <andreasasm...@gmail.com>

>
> Hi
>
> You could do onCompletion().onFailureOnly() and in the same route as you do
> the message history route the message to your error destination. This of
> course also means that you have to remove the "moveFailed" option.
>
> from("file:in?move=archive/${date:now:yyyyMMdd}/${file:name}")
> .onCompletion().onFailureOnly()
>
>
> .wireTap("file:failed/${file:name.noext}-${date:now:yyyyMMddHHmmssSSS}.${file:ext}")
>         .process(new FileHistoryProcessor())*
>        .end()
> .to("file:out");
>
> Something like that? Not sure about the syntax since I use Spring DSL.
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/onCompletion-for-failed-exchanges-tp3281388p3281414.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Reply via email to