【问题标题】:how to use poller in int-ftp:outbound-gateway?如何在 int-ftp:outbound-gateway 中使用轮询器?
【发布时间】:2023-04-08 01:08:02
【问题描述】:

首先,感谢您的关注 我定义了一个带有轮询的出站网关 ftp 适配器,如下代码:

<int-ftp:outbound-gateway id="gatewayLS"
                              session-factory="ftpClientFactory"
                              request-channel="inboundFileChannel"
                              command="ls"
                              command-options="-1"
                              expression="'books/*'"
                              reply-channel="outboundJobRequestChannel">
        <int:poller fixed-rate="5000"/>
    </int-ftp:outbound-gateway>

但我遇到了以下异常:
org.xml.sax.SAXParseException;行号:57;列号:40; cvc-complex-type.2.4.a:发现以元素“int:poller”开头的无效内容。需要 '{"http://www.springframework.org/schema/integration/ftp":request-handler-advice-chain}' 之一。 上述问题的正确措施是什么? 谢谢

【问题讨论】:

    标签: spring ftp spring-integration


    【解决方案1】:

    这是fixed in version 4.1。当前版本是 4.1.3。

    如果您无法迁移到 4.1.x(推荐),您可以添加 &lt;bridge/&gt; 以将可轮询通道桥接到直接通道。

    【讨论】:

    • 感谢 gary 的快速回复,它已成功,但返回空列表并显示以下消息:DEBUG PollingConsumer:208 - 投票期间未收到任何消息,返回 'false'
    • 空列表意味着找不到与请求的模式匹配的文件。 'Received no message...` 仅表示inboundFileChannel 中没有消息。
    • 感谢@Gary Russell 的回复,我确定ftp 根目录包含许多文件和目录,我将command-options attr 更改为-dirs,并将频道更改为波纹管&lt;int:channel id="output"&gt; &lt;int:queue/&gt; &lt;/int:channel&gt; &lt;int:channel id="inboundGet"&gt; &lt;int:queue/&gt; &lt;/int:channel&gt; 但不固定:(
    • 如果你得到一个空列表,那么没有匹配books/*的文件。
    • payload 仅表示消息有效负载包含ls 搜索的路径。我建议您查看诸如wireshark 之类的网络监视器,以查看与您的服务器的交互。
    猜你喜欢
    • 2023-03-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-06-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多