Hello,

I'm using Camel to receive message via SOAP and send them to a FTP server (via 
a toD endpoint with the same FTP URL). 

When one message is sent, everything is fine, but when multiple messages are 
processed in parallel, some calls to the FTP server start failing in a random 
manner. From the logs I have the impression that FTP response codes from one 
request leak into other requests and I was wondering if the FTP endpoint is 
thread-safe.

The Camel documentation claims that the FTP producer supports concurrency
https://camel.apache.org/components/2.x/ftp-component.html#_concurrency

But looking at the code I see that FtpEndpoint only contains one FtpClient 
instance and the FAQ at 
https://cwiki.apache.org/confluence/display/COMMONS/Net+FrequentlyAskedQuestions
 says:
„... If you want to share a single FTPClient instance between multiple threads, 
you must serialize access to the object with critical sections.“
One example: FtpClient extends FTP extends SocketClient, where the instance 
variable _socket_ is overwritten by every connect() call. Using this from 
multiple threads does not seem to be safe.

I did not find any synchronization or serialization in the Camel coding so far.

==> Is the FtpEndpoint thread-safe for parallel requests writing files to a FTP 
server? Or is this a bug?

Best regards, 
Christian

Reply via email to