Since we're on a major migration process of this website, some component documents here are out of sync right now. In the meantime you may want to look at the early version of the new website
https://camel.apache.org/staging/
We would very much like to receive any feedback on the new site, please join the discussion on the Camel user mailing list.

Why does my file consumer not pick up the file, and how do I let the file consumer use the Camel error handler?

There could be several reasons why the File consumer is not picking up files. For example it may not run at all, or it cannot acquire a read lock on the file.
Check the logs for any exceptions or other informative messages. You can turn on DEBUG logging at org.apache.camel.component.file to see more detail.

How to use Camel's routing error handlers with the file consumer

Well, this is really a "chicken or the egg" question. The Camel error handler (e.g., in the routes) only applies when a message is being routed by the routing engine.
Before this happens, a consumer must successfully receive a message, create a Camel Exchange, populate the Exchange with message details (e.g., body and headers), and then pass the Exchange to the routing engine. Only at this point can the routing error handler deal with exceptions occurring. Before this point, any error handling is really Component-specific.

Bridge with error handler

From Camel 2.10 onwards the file and ftp consumers can now bridge to the Camel routing engine's error handler. See more details at the consumer.bridgeErrorHandler option on the File documentation.

If the component consumer extends the DefaultConsumer from Camel, then it offers an org.apache.camel.spi.ExceptionHandler hook for end users to plug-in a custom strategy. The default implementation from Camel is LoggingExceptionHandler that will log the exception at ERROR/WARN level, and then ignore the exception.

See the File page in the bottom for an example how to use a custom ExceptionHandler that sends a new message to the Camel routing engine, which then allows the routing engine to trigger its own error handling to deal with the exception.

© 2004-2015 The Apache Software Foundation.
Apache Camel, Camel, Apache, the Apache feather logo, and the Apache Camel project logo are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners.
Graphic Design By Hiram