You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Ioannis Sermetziadis (JIRA)" <ji...@apache.org> on 2017/11/27 00:48:00 UTC

[jira] [Comment Edited] (CAMEL-11792) New ftp connection for each file transfer with tempFileName option in URI

    [ https://issues.apache.org/jira/browse/CAMEL-11792?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16266276#comment-16266276 ] 

Ioannis Sermetziadis edited comment on CAMEL-11792 at 11/27/17 12:47 AM:
-------------------------------------------------------------------------

Hello! I spent some time on this issue. 

I searched a bit how Camel creates new endpoints and when running the example code, it does not create multiple endpoints. So IMHO a single endpoint instance that uses a single FTP client instance is used for all ftp calls.

So I ended up checking the Apache FTP client on which the camel-ftp component depends. The library seems to intentionally open two (control & data) connections for each FTP command, while a Camel endpoint might require one or more FTP command to complete. So, to me, it is clear that this is a limitation of the library.

Maybe this could be made possible by implementing a wrapper SocketFactory and ServerSocketFactory that would reuse the connections instead of closing them. But this seems more like a work-around. Maybe other FTP client implementations do not have this limitation.

On the other side, I am wondering if such an approach of unifying all the FTP connections into one connection, is a good idea. This will probably affect the throughput because all the socket reads and writes will need to be serialized (socket not thread-safe). Or maybe this is a limitation of the FTP protocol itself.

What do you think? I would volunteer to work on an agreed solution/fix/work-around.



was (Author: sermojohn):
Hello! I spent some time on this issue. 

I searched a bit how Camel creates new endpoints and when running the example code, it does not create multiple endpoints. So IMHO a single endpoint instance that uses a single FTP client instance is used for all ftp calls.

So I ended up checking the Apache FTP client on which the camel-ftp component depends. The library seems to intentionally open two (for command & data) connections for each FTP command, while a Camel endpoint might require one or more FTP command to complete. So, to me, it is clear that this is a limitation of the library.

Maybe this could be made possible by implementing a wrapper SocketFactory and ServerSocketFactory that would reuse the connections instead of closing them. But this seems more like a work-around. Maybe other FTP client implementations do not have this limitation.

On the other side, I am wondering if such an approach of unifying all the FTP connections into one connection, is a good idea. This will probably affect the throughput because all the socket reads and writes will need to be serialized (socket not thread-safe). Or maybe this is a limitation of the FTP protocol itself.

What do you think? I would volunteer to work on an agreed solution/fix/work-around.


> New ftp connection for each file transfer with tempFileName option in URI
> -------------------------------------------------------------------------
>
>                 Key: CAMEL-11792
>                 URL: https://issues.apache.org/jira/browse/CAMEL-11792
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-ftp
>    Affects Versions: 2.19.2
>            Reporter: Himanshu Mittal
>            Priority: Minor
>         Attachments: TestFTPConnection.java
>
>
> When we have {{tempFilename}} in camel uri and we use producer template to write file to remote ftp location , camel opens new connection for every file transfer. Though disconnect option is set to false in uri.
> If we take out tempFilename from uri connections are reused
> We can verify it by running attached sample. 
> Check the connections made from camel server to ftp server . Fire {{netstat -an|grep 10.80.14.56|wc -l]] 
> - When we have tempFileName in uri it will show 1 connection per file transfer
> - Without tempFileName it will show only 1 connection for all files transfer.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)