【问题标题】:how to get number to number specified of file by int-ftp:outbound-gateway with `ls` and `gets` command??如何使用 `ls` 和 `gets` 命令获取 int-ftp:outbound-gateway 指定的文件编号?
【发布时间】:2015-09-07 10:14:31
【问题描述】:

感谢关注,我使用了 spring 集成和 spring 批处理,我有一个 ftp 服务器来处理我的文件,在 ftp 服务器中存在我用 ftp 适配器读取的 1000 多个文件,我想要一种读取数字的方法number文件例如10到10读取文件,怎么办?
我的代码是:

<int-ftp:outbound-gateway id="gatewayLS"
                          session-factory="ftpSessionFactory"
                          request-channel="inbound"
                          command="ls"
                          command-options="-R"
                          expression="payload"
                          reply-channel="inputFileSplitter"/>

【问题讨论】:

    标签: spring spring-integration spring-batch


    【解决方案1】:

    没有办法限制ls 命令返回的条目数; FTP 不支持它。

    您可以添加过滤器,但网关仍会在过滤之前获取所有条目。

    不过,您可以使用模式。

    注意ls 只返回文件元数据(或只是文件名);它不会检索文件本身。

    另一种限制返回列表大小的方法是不使用-R,而是自己递归到目录中。

    【讨论】:

    • 感谢@gary 的响应,因为我在使用 ftp 适配器在 ftp 服务器上获取或放置许多文件(超过 100 个)时检索到以下异常 throws an org.apache.commons.net.io.CopyStreamException: IOException caught while copying
    • 您需要显示完整的堆栈跟踪。也看看你的服务器日志。
    猜你喜欢
    • 1970-01-01
    • 2023-04-08
    • 1970-01-01
    • 2023-03-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-05-03
    相关资源
    最近更新 更多