user3544765
user3544765

Reputation: 476

Spring Integration CachingSessionFactory how to set auto disconnect FTP connection when exceeds IDLE time

In Spring Integration, if caching session factory be used for FTP, how to set the auto disconnect connection if exceeds certain IDLE time?

Background information: My program is based on FtpOutboundGatewaySample-context.xml SI sample, I used the "ls" command in FTP Outbound gateway --> split the result --> and call "get" commandy with Ftp Outbound Gateway for each file to be downloaded.

Without CachingSessionFactory, the FTP connection will be disconnected for every file be downloaded.

I tried to add the CachingSessionFactory with an appropriate waiting timeout value. Now, the connection will be reused and won't call disconnect for every file be downloaded.

But now, I don't know how to make the FTP connection be disconnected automatically if no more file is available for download. I guess some IDLE timeout could be set somewhere.

Upvotes: 1

Views: 878

Answers (1)

Gary Russell
Gary Russell

Reputation: 174574

Typically, the server will close the session after a timeout (configured on the server); the cache will detect the closed session the next time it's used and discard it.

There's no way to set a timeout on the client side.

Upvotes: 1

Related Questions