【问题标题】:Spring Integration Sending Files to Remote DirectorySpring集成将文件发送到远程目录
【发布时间】:2017-06-30 15:25:16
【问题描述】:

我正在尝试通过 FTP 将文件从本地目录发送到远程目录, 并且能够成功发送文件,但另外文件正在通过 FTP 传输到本地目录,因为 ftpInbound 也在建立 FTP 连接,我不希望我的应用程序这样做。如果我删除入站 FTP 通道适配器,也无法将本地目录路径提供给 ftpOutbound。有没有其他方法可以解决这个问题?

<int-ftp:inbound-channel-adapter id="ftpInbound"
                                channel="ftpChannel" 
                                session-factory="ftpClientFactory"
                                filename-pattern="*.txt"
                                local-directory="$dina-communication.batch-{localDirectory}"
                                temporary-file-suffix=".writing">
<int:poller fixed-rate="10000" />

</int-ftp:inbound-channel-adapter>

<int-ftp:outbound-channel-adapter  id="ftpOutbound"
                                channel="ftpChannel" 
                                session-factory="ftpClientFactory"
                                remote-directory="$dina-communication.batch-{Remote_directory}"
                                temporary-file-suffix=".writing">
</int-ftp:outbound-channel-adapter>

【问题讨论】:

    标签: spring-boot ftp spring-integration


    【解决方案1】:

    如果您谈论将本地目录内容提供给FTP服务器,您应该考虑使用真正的&lt;int-file:inbound-channel-adapter&gt;http://docs.spring.io/spring-integration/reference/html/files.html#file-reading

    还有一个关于此事的样本:https://github.com/spring-projects/spring-integration-samples/tree/master/basic/file

    您应该将 &lt;int-ftp:inbound-channel-adapter&gt; 替换为 &lt;int-file:inbound-channel-adapter&gt;

    【讨论】:

    • 列号:43;元素“int-file:inbound-channel-adapter”的前缀“int-file”未绑定。在 org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:70) ---我收到上述错误,int-file 无法与 int-ftp 匹配,因为我的出站目录是远程服务器。它也适用于远程服务器吗?
    • 你的类路径中应该有spring-integration-file 并且有一个正确的XSD 定义。您可以在提供的示例中找到:http://www.springframework.org/schema/integration/file http://www.springframework.org/schema/integration/file/spring-integration-file.xsd
    猜你喜欢
    • 2014-10-27
    • 2022-08-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-04-20
    • 1970-01-01
    • 2021-07-06
    相关资源
    最近更新 更多