当我们使用spring入站通道适配器连续轮询它时,sftp服务器是否会挂起

时间:2013-10-03 10:33:17

标签: spring-integration

我正在使用spring integation poller从sftp服务器下载文件

<int-sftp:inbound-channel-adapter channel="myFileDownloadChannel"
                                      session-factory="mySftpSessionFactory"
                                      remote-directory="#{remote}"
                                      filter = "modifiedFileListFilter"
                                      local-directory="#{local}"
                                      auto-create-local-directory="true">
<integration:poller cron="10 * * * * *" default="true"/>
</int-sftp:inbound-channel-adapter>

 <integration:service-activator input-channel="myFileDownloadChannel"
                                ref="errorTransformer" 
                                output-channel="endChannel"/>

我在6台服务器上运行此代码。

  1. 如果6台服务器每10分钟轮询一次,它会挂起sftp服务器吗?
  2. 每次触发轮询器时都会建立新连接吗?
  3. 请建议。

2 个答案:

答案 0 :(得分:0)

  1. 这取决于服务器,但它可能不是什么大问题;对我来说听起来不是很高。
  2. 您可以将会话工厂包装在CachingSessionFactory中以保持会话打开,但是许多服务器都配置为无论如何都要丢弃空闲连接。

答案 1 :(得分:0)

将布尔变量"cache-sessions = false"添加到<int-sftp:inbound-channel-adapter

默认情况下 TRUE 。并保留connections open.

将其设为 FALSE ,它将close sessions per use