如何在int-ftp:outbound-gateway中使用表达式获取子目录?

时间:2015-04-20 12:58:52

标签: spring ftp spring-integration

首先感谢您的关注 我有一个spring集成项目,它监听ftp服务器接收不同目录下的文件并处理它,ftp目录结构是:
FTP根
-----------一个\
-----------------在\
--------------------------- A.TXT
-----------------出\
------------ b \
-----------------在\
--------------------------- b.txt
-----------------出\

我使用int-ftp:outbound-gateway适配器来运行ls recursive命令,如何在expression中编写int-ftp:outbound-gateway attr来获取 a.txt b。在 in 目录中的txt ,我的适配器代码为:

 <int-ftp:outbound-gateway id="gateway1"
                              session-factory="ftpClientFactory"
                              request-channel="inbound1"
                              reply-channel="outbound"
                              reply-timeout="777"
                              auto-create-local-directory="false"
                              auto-startup="true"
                              command="ls"
                              command-options="-1 -R"
                              expression="'*/in/'"
                              mput-regex=".*">

    </int-ftp:outbound-gateway>

但没有正确使用,怎么写?

1 个答案:

答案 0 :(得分:1)

看起来MGET操作适合您:

<int-ftp:outbound-gateway id="gatewayLS"
    session-factory="ftpSessionFactory"
    request-channel="inbound"
    command="mget"
    command-options=""
    expression="payload"
    local-directory="/tmp/out"
    reply-channel="resultChannel"/>

FTP Outbound Gateway MGET