Hi,

Can you set the deadLetterChannel with a direct endpoint, and chain the
custom processing and file endpoint as you want.

errorHandler(deadLetterChannel("direct:ErrorProcessor").disableRedelivery().logStackTrace(false).useOriginalMessage());

from("file://target/originalexchange?noop=true")
  .transform(body().append(" World"))
  .to("jms...");

from("direct:ErrorProcessor")
  .process(customerProcessor())
  .to("file://errorFile");

Willem

ankelee wrote:
Hi

In relation to this post:
http://old.nabble.com/errorHandler-%2B-.handled%28false%29%29--in-Spring-DSL.-td28670904.html

I'm really stuck on my use case.

<from file>
<to translator>
<to jms>

1) If route fails I want to move the original file through some custom
processing steps and send it to a directory (and remove it from the source
directory (consume it)).
2) If route completes I want to move the original file to a backup
directory.

2) Could be solved either by using: <onCompletion onComeplete="true">
<to backupdir>
</onCompletion>

or by putting ?move=backup on the file endpoint.

The problem is then that 1) negates this by handling the exception. ?move=
and onCompletion then thinks that the route ended succesfully and go ahead
and move the file to the backup folder anyways.

So what to do? Don't handle the exception by using onException. This would
be ok too, but then the file will not be deleted/consumed from the source
directory such as the deadletterErrorHandler would do.

This seems like a really really simple thing to do but I guess I'm using a
wrong combination of components for it.

Any ideas?


Reply via email to