Spring integration int sftp出站网关命令选项被忽略
我正在尝试使用SpringIntegration4.1.5从远程目录及其所有子目录获取文件名列表。因为我只能使用SFTP连接到远程服务器,所以我需要使用Spring integration int sftp出站网关命令选项被忽略,spring-integration,Spring Integration,我正在尝试使用SpringIntegration4.1.5从远程目录及其所有子目录获取文件名列表。因为我只能使用SFTP连接到远程服务器,所以我需要使用int-SFTP:outbound-gateway。看起来这很简单: <int-sftp:outbound-gateway id="remoteSftpLS" session-factory="sftpSessionFactory" request-channel="triggerChannel"
int-SFTP:outbound-gateway
。看起来这很简单:
<int-sftp:outbound-gateway id="remoteSftpLS"
session-factory="sftpSessionFactory"
request-channel="triggerChannel"
command="ls"
command-options="-1 -R"
remote-file-separator="/"
expression="payload"
charset="UTF-8"
filter="fileFilter"
reply-channel="lsResultChannel" />
但是,似乎我在命令选项中输入的任何内容都被忽略了:
- 不管我是否使用-R,我只从 顶级目录李>
- 无论是否使用-1,我只获取
对象,而不是文件名字符串FileInfo
我在这里遗漏了什么?没有意义。我们只是在本地进行了测试。结果是:
payload = {ArrayList@3873} size = 3
0 = "sftpSource1.txt"
1 = "sftpSource2.txt"
2 = "subSftpSource/subSftpSource1.txt"
SftpServerOutboundTests.testInt3172LocalDirectoryExpressionMGETRecursive
将sftpSource
作为远程目录,并:
<int-sftp:outbound-gateway session-factory="sftpSessionFactory"
request-channel="inboundMGetRecursive"
command="ls"
expression="payload"
command-options="-1 -R"
reply-channel="output"/>
它似乎不是过滤器。我实现了一个简单的、只记录日志的过滤器,它返回与上面相同的值(目标目录的内容,而不是任何子目录)。我还在调查;我开始怀疑我的Spring集成版本是否太过时了(它是4.1.5)。没有操作。
LS
的代码从那以后就没有更改过。你能调试一下AbstractRemoteFileOutboundGateway.ls()并试着弄清楚发生了什么吗?事实上是过滤器!以隐藏的方式。以前的开发人员使用过滤器作为端点,这种方式很奇怪,也没有什么特别之处。我用维修激活剂更换了它,并拆下了过滤器,一切正常。谢谢你的指点!
protected final List<F> filterFiles(F[] files) {
return (this.filter != null) ? this.filter.filterFiles(files) : Arrays.asList(files);
}