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