Can't handle post read rename/delete errors in Camel file consumers
Environment
- Red Hat JBoss Fuse 6.1.0
Issue
- There does not appear to be any way to handler or be informed of post-read delete/rename errors in GenericFileConsumer implementations
- The on completion action is installed...
org.apache.camel.component.file.GenericFileConsumer#processExchange
lines 392-394 ...
// register on completion callback that does the completion strategies
// (for instance to move the file after we have processed it)
exchange.addOnCompletion(new GenericFileOnCompletion<T>(endpoint, operations, target, absoluteFileName));
- This exposes no reference to the GenericFileOnCompletion instance so the default LoggingExceptionHandler cannot be replaced in order react to errors (so they are logged, but the running code will never "know" about them).
Resolution
We have implemented new feature in Camel [1] that allows you plug in a custom login into the completion of the unit of work. That feature will be included in Camel 2.16 i.e. in Fuse 6.3.
In the meantime the workaround for the issue would be to override the FileProcessStrategy.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
