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: Changing from file-consumer to ftp-consumer
Date Wed, 27 Jun 2012 12:21:43 GMT
Hi

See the pollStrategy option at
http://camel.apache.org/polling-consumer.html

And from Camel 2.10 onwards you can bridge this consumer error with
the Camel error handler in the route using the new
consumer.bridgeErrorHandler option
http://camel.apache.org/file2


On Wed, Jun 27, 2012 at 2:14 PM, stefzar <stefzar@hotmail.com> wrote:
> 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.



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

Mime
View raw message