【问题标题】:Int:Splitter is not sending messages to channels to invoke themInt:Splitter 没有向通道发送消息来调用它们
【发布时间】:2017-10-16 20:12:51
【问题描述】:

我正在尝试将消息从 int-file:inbound-channel-adapter 发送到 int-ftp:outbound-channel-adapter 以将文件移动到远程目录和 int-ftp:outbound-gateway 以删除远程目录中的文件。

现在 int-file:inbound-channel-adapter 轮询并向 int-ftp:outbound-channel-adapter 发送消息,并在第二次轮询时向 int-ftp:outbound-gateway 发送消息。

通过使用 int:splitter,我仍然能够接收单个文件的单个消息,并且只有一个通道被调用。我想将每条投票消息发送到两个频道。

示例如下:

现在工作:

  1. 首次轮询将消息发送到 int-ftp:outbound-channel-adapter
  2. 第二次轮询将消息发送到 int-ftp:outbound-gateway
  3. 第三次轮询将消息发送到 int-ftp:outbound-channel-adapter
  4. 第四次轮询将消息发送到 int-ftp:outbound-gateway

想要达到的目标

1.First time polls 向 int-ftp:outbound-channel-adapter 和 int-ftp:outbound-gateway 发送消息 2.Second time polls 向 int-ftp:outbound-channel-adapter 和 int-ftp:outbound-gateway 发送消息

提前致谢

<int-file:inbound-channel-adapter id="inErrorINPRm"
                                channel="errorRm" 
                                directory="in/error"
                                >
    <int:poller fixed-rate="5000" />
</int-file:inbound-channel-adapter>

<int:channel id="errorRm"></int:channel>
<int:channel id="ErrorRmMv"></int:channel>
<int:channel id="ftpINPfromError"></int:channel>

<int:splitter id="splitter" input-channel="errorRm" output-channel="ErrorRmMv"/>

<int-ftp:outbound-channel-adapter id="ftpError"
                                channel="ErrorRmMv" 
                                session-factory="ClientFactory"
                                auto-create-directory="true"
                                remote-directory="in/error"
                                >
</int-ftp:outbound-channel-adapter>

<int:header-enricher id="header-enricher-error" input-channel="ErrorRmMv" output-channel="ftpINPfromError">
    <int:header name="file_remoteDirectory" value="in/working"/>

</int:header-enricher>

<int-ftp:outbound-gateway id="gatewayRmfromError"
                          session-factory="ClientFactory"
                          expression="file_remoteDirectory"
                          request-channel="ftpINPfromError" 
                          command="rm" 
                          >
</int-ftp:outbound-gateway>

【问题讨论】:

    标签: spring-integration


    【解决方案1】:

    拆分器没有要拆分的内容 - 有效负载已经是单个 File

    拆分器用于将列表拆分为每个列表元素的消息。

    您需要为适配器创建输入通道,并将标头丰富器添加为 &lt;int:publish-subscribe-channel/&gt; - 您可以将 order="1" 添加到适配器,将 order="2" 添加到丰富器,以明确调用它们的顺序.

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-05-03
      • 1970-01-01
      • 2018-06-04
      • 2021-03-24
      • 1970-01-01
      • 1970-01-01
      • 2021-01-03
      相关资源
      最近更新 更多