Exclude camel file exception

When I try to process a file in Camel and it doesn't work, I try to move the file to the error directory, but I get the following error:

org.apache.camel.component.file.GenericFileOperationFailedException: Unable to delete file: ....

I don't know if Windows is blocking the file, but I have closed threads that could cause this to happen on my side. If this is Windows, what can I do to release this lock?

The route is simple from()... process().. to()

and process()

there are some headers after . This to()

is where it fails and the file is not moved to the error directory as expected.

Thank.

+3


source to share


2 answers


There seemed to be a stream of outcasts that needed to be changed. I found this using Process Explorer as it identified the same file twice. One lock was removed and the other was not, and from this I discovered an open stream that was not being processed in the block catch

.



+2


source


Perhaps it has something to do with this :



Unable to move / delete file after processing in Windows

There is a potential issue on Windows platform with Camel 1.5.x. That it cannot move or delete the file after processing. You should get an exception.

A workaround is to convert the body to a string after consumption using convertBodyTo: ex. from ("file: // incoming") .convertBodyTo (String.class) .to ("file: // outgoing") ;.

Camel 1.6.0 should have a fix, but we'd love to get some feedback on this. So if you are on Windows, please give it a go.

+2


source







All Articles