Hi

Just a note about your Java DSL route.

What you do looks much more like the Content Based Router (eg if ...
else if ... else if ... else).
http://camel.apache.org/content-based-router

So you may want to look into that instead of using the filter EIP if
you think the code is more readable.


And in terms of the FTP error. What version of Camel are you using? We
have fixed some pieces in recent times about detecting
broken connection and re-connection.

If you do not want to keep the connection alive, you can use the
disconnect=true option. Then you force Camel to re-login on each poll.
This could make sense if there is a long delay between polls.



On Mon, Jan 16, 2012 at 9:25 AM, Niels <ni...@kabisa.nl> wrote:
> Hey everybody,
>
> I'm using to ftp component to consume from a ftp server.
> The little application seems to do the job but when investigating the log 
> files this exception shows up:
>
> Trying to recover by disconnecting from remote server forcing a re-connect at 
> next poll: ftp://userl@server:21
>  Error occurred while disconnecting from ftp://user@server:21 due: File 
> operation failed: 421 Terminating connection.
>  FTP response 421 received.  Server closed connection.. Code: 421. This 
> exception will be ignored.
>  Consumer 
> FtpConsumer[ftp://server?delay=900000&delete=true&password=******&username=user]
>  could not poll endpoint: Endpoint[ftp://server?de$
>  FTP response 421 received.  Server closed connection.. Code: 421
>  org.apache.camel.component.file.GenericFileOperationFailedException: File 
> operation failed: 421 Timeout (120 seconds): closing control connection.
>  FTP response 421 received.  Server closed connection.. Code: 421
>        at 
> org.apache.camel.component.file.remote.FtpOperations.getCurrentDirectory(FtpOperations.java:569)
>        at 
> org.apache.camel.component.file.remote.FtpConsumer.pollDirectory(FtpConsumer.java:45)
>        at 
> org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:100)
>        at 
> org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:140)
>        at 
> org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:92)
>        at 
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
>        at 
> java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
>        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
>        at 
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
>        at 
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180)
>        at 
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204)
>        at 
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>        at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>        at java.lang.Thread.run(Thread.java:662)
> Caused by: org.apache.commons.net.ftp.FTPConnectionClosedException: FTP 
> response 421 received.  Server closed connection.
>        at org.apache.commons.net.ftp.FTP.__getReply(FTP.java:347)
>        at org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:495)
>        at org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:537)
>        at org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:586)
>        at org.apache.commons.net.ftp.FTP.pwd(FTP.java:1381)
>        at 
> org.apache.commons.net.ftp.FTPClient.printWorkingDirectory(FTPClient.java:1990)
>                at 
> org.apache.camel.component.file.remote.FtpOperations.getCurrentDirectory(FtpOperations.java:567)
>                ... 13 more
>
> This is the route I'm using to consume the service:
>
> from("ftp://"; + props.getProperty(FTP_URL) + "?username=" + 
> props.getProperty(FTP_USER) + "&password=" + props.getProperty(FTP_PWD) + 
> "&delete=true&delay=" + props.getProperty(FTP_DELAY))
>                        .filter(xmlPredicate)
>                                .to("jms:xmlQueue").end()
>                        .filter(imgPredicate)
>                                .to("file://" + props.getProperty(ROOT_DIR) + 
> "/img").end()
>                        .filter(pdfPredicate)
>                                .to("file://" + props.getProperty(ROOT_DIR) + 
> "/pdf").end()
>                        .to("file://" + props.getProperty(ROOT_DIR) + "/junk");
>
> Now I'm wondering if this could be an issue with camel? In my opinion I think 
> it has something to do with the FTP server itself and not so much with camel.
> Therefore I'm asking some experts opinion on my issue.
>
> And please if you have any remarks on my code, I happy to here them I'm just 
> a novice when it comes to camel.
>
> Thanks!
>
> Regards,
>
> Niels
>
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Reply via email to