camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: onCompletion for failed exchanges
Date Fri, 26 Nov 2010 14:34:58 GMT
You use the moveFailed option on the file component which means it
handles the failures and mark the Exchange is completed.



On Fri, Nov 26, 2010 at 3:31 PM, Bengt Rodehav <bengt@rodehav.com> wrote:
> I'm currently implementing a message history store. I use onCompletion to
> trigger when to store message details in my store. One piece of critical
> information is whether the exchange was successful or not. To determine this
> I call the isFailed() method on the exchange but this never seem to evaluate
> to true.
>
> My route looks like this:
>
> *
>> from("file:in?move=archive/${date:now:yyyyMMdd}/${file:name}&moveFailed=failed/${file:name.noext}-${date:now:yyyyMMddHHmmssSSS}.${file:ext}")
>> *
>
> *  .onCompletion()*
>
> *    .process(new FileHistoryProcessor())*
>
> *    .end()*
>
> *  .to("file:out");*
>
>
> and the process method of the FileHistoryProcessor class looks like this:
>
> *public void process(Exchange theExchange) throws Exception {*
>
> *  if(theExchange.isFailed()) {*
>
> *    // I never get here*
>
> *  }*
>
> *  else {*
>
> *    // I always get here*
>
> *  }*
>
> *}*
>
>
> If I force an exchange to fail by changing my route to
> "....to("file:G:/out") (I don't have a G:), the route fails and the file is
> moved to the "failed" folder but *theExchange.isFailed()* is still false.
>
> Have I misunderstood the meaning of isFailed()? If so, how can I detect, in
> my onCompletion processor,  whether the exchange successfuly passed through
> my route or not?
>
> I use Camel 2.5.0.
>
> /Bengt
>



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

Mime
View raw message