camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Morgan Hautman" <>
Subject RE: Time consuming route starting at FTP endpoint
Date Fri, 09 Jan 2015 12:33:38 GMT
Hi Neil,

Maybe try to connect via SFTP since there is no data timeout value for it (under "timeout"
option : For SFTP there is no data timeout.)

Hope this helps!



-----Original Message-----
From: neil Stevens [] 
Sent: vrijdag 9 januari 2015 13:17
Subject: Time consuming route starting at FTP endpoint


I'm after some advice from people more experienced in Camel than myself on what the correct
way is to structure my route(s).  My program essentially does the following:

1. Downloads file from FTP server
2. Saves a copy of the file (for auditing purposes) 3. Does some additional (time consuming)
processing on the data

Therefore my code is like:


I use the "move" option on the FTP component to move the file after processing so it will
not be processed again.  My problem is often by the time the processing (step 3) has completed
the FTP connection is closed, so the file can not be moved resulting in the following exception
stack trace:

File operation failed: null Connection is not open. Code: 221 at org.apache.camel.component.file.remote.FtpOperations.buildDirectory(
at org.apache.camel.component.file.strategy.GenericFileProcessStrategySupport.renameFile(
at org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy.commit(
at org.apache.camel.component.file.GenericFileOnCompletion.processStrategyCommit(
at org.apache.camel.component.file.GenericFileOnCompletion.onCompletion(
at org.apache.camel.component.file.GenericFileOnCompletion.onComplete(
at org.apache.camel.util.UnitOfWorkHelper.doneSynchronizations(
at org.apache.camel.impl.DefaultUnitOfWork.done(
at org.apache.camel.util.UnitOfWorkHelper.doneUow(
at org.apache.camel.processor.CamelInternalProcessor$UnitOfWorkProcessorAdvice.after(
at org.apache.camel.processor.CamelInternalProcessor$UnitOfWorkProcessorAdvice.after(
at org.apache.camel.processor.CamelInternalProcessor$InternalCallback.done(
at org.apache.camel.impl.MDCUnitOfWork$MDCCallback.done(
at org.apache.camel.processor.Pipeline.process(
at org.apache.camel.processor.CamelInternalProcessor.process(
at org.apache.camel.component.seda.SedaConsumer.sendToConsumers(
at org.apache.camel.component.seda.SedaConsumer.doRun(
at java.util.concurrent.ThreadPoolExecutor.runWorker(
at java.util.concurrent.ThreadPoolExecutor$
Caused by: Connection is not open at
at org.apache.camel.component.file.remote.FtpOperations.buildDirectory(
... 20 more

Therefore my thinking was I can just restructure the code so the file is moved on the FTP
server after I've saved a copy of it.  I hoped I would be able to achieve this by putting
in a SEDA component:



However this does not achieve what I want.  The file will still not be renamed on the FTP
server until "additionalProcessing" completes.  I tried setting the SEDA component options
and "exchangePattern=InOnly" in the hope that this may help but it doesn't.

I thought of 2 ideas how I can achieve what I want (with my current understanding of Camel),
but I don't think either is the correct solution (and I have not tested either yet).  Solution
1 is to divide it into 2 routes and write it to a temporary location:



This seems wrong as it adds the extra IO overhead.  Solution 2 is to use wiretap EIP as follows:


However I keep getting the feeling the above solution would be a misuse of the wiretap EIP.
 Does any one have any idea what the correct way to do this in Camel would be?

Thanks in advance for any advice any one can give me.


View raw message