OK, I think I understand the problem. Do you have any suggestions as to how
I can keep using moveFailed but determine in onCompletion that this was
done?

Actually, I also do the following:

*onException(Exception.class)*

*  .maximumRedeliveries(mMaxRedeliveryAttempts)*

*  .delayPattern(mDelayPattern)*

*  .process(new LogProcessor(getName()));*


The purpose is to log any failed files (and later on notify the user in a
better way). Is this a good place to set a custom property on the exchange
to mark it as "failed" and then later look at this property in the
onCompletion?

Is there a best practice for this?

/Bengt

2010/11/26 Claus Ibsen <claus.ib...@gmail.com>

> 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 <be...@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: cib...@fusesource.com
> Web: http://fusesource.com
> Twitter: davsclaus
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/
>

Reply via email to