I have tried it with exception handling now.

My route looks like this:

context.addRoutes(new RouteBuilder() {
        public void configure() {

onException(org.apache.camel.component.file.GenericFileOperationFailedException.class).log("Exception
caught");
                                

from("ftp:stefan@127.0.0.1:21/Notification/?noop=true&password=password&recursive=true&sendEmptyMessageWhenIdle=true").to("file:storage");
        }
});

The onException-clause works fine if the folder "Notification" does exist
(meaning the "Exception caught" string will be logged), but if it does not
then there is also a GenericFileOperationFailedException but it won't be
catched by the onException-clause.

How can I catch the Exception if the folder does not exist? The difference
is that in case of the existing folder the consumer sends an empty message
and the exception occurs at the .to-clause and in case of the non existing
folder the consumer throws the Exception. I guess the problem is that the
exception won't pass the default error handler if it's thrown by the
consumer.

Or in other words: How can I catch Exceptions thrown by a consumer?

--
View this message in context: 
http://camel.465427.n5.nabble.com/Changing-from-file-consumer-to-ftp-consumer-tp5715125p5715161.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to