I have following Camel route, created by a RoutingBuilder:
This route is the only one which I place on my CamelContext and than I start the CamelContext.
I'm doing a test on my local machine to send 50 files through this route to a remote SFTP server. Most of the time, all files arrive, but sometimes 1 file seems to be missing.
My program doesn't notice the failure of sending. But during debugging I found something interesting that happened.
That one specific file which is missing throws in the camel library an SFTPException at the method existsFile (SftpOperations.java:1046).
The exception contains only reason 4: message but the exception contains another exception. The wrapped exception contain following exception message: java.io.IOException: Pipe Closed.
Camel wraps the exception in a GenericFileOperationFailedException and throws it to the method which called SftpOperations, GenericFileProducer (GenericFileProducer.java:135).
That exception arrives in the tr/catch block of it and goes to the generic catch block.
In that catch-block the exception is handled by the handleWrite() method (RemoteFileProducer.java:83) and there it gets interesting.
In handleWrite() check is performed if the Camel Base Service is in stopping() or stopped() state. If that's the case, the exception is only logged but not thrown. But isStopped() returns true, so my exception is thrown, but my application doesn't receive it, so it thinks that the file is transferred succesfully to the SFTP server, but it never arrives.