int-ftp:入站通道适配器轮询器控件

时间:2017-04-04 06:40:46

标签: spring-integration

我们使用int-ftp:inbound-channel-adapter和固定速率轮询器。出于维护目的,我们希望能够在需要时停止轮询器(使用URL)。我们使用以下适配器配置。

<int-ftp:inbound-channel-adapter id="inboundAdapter"
        channel="inputChannel" session-factory="sessionFactory"
        charset="UTF-8" auto-create-local-directory="false"
        delete-remote-files="true" filename-regex="^.*\.(txt|in)$"
        remote-directory="${remote.directory}" local-directory="${local.directory}">
        <poller max-messages-per-poll="-1" fixed-rate="3000" error-channel="errorChannel"/>
    </int-ftp:inbound-channel-adapter>

以下是我们需要添加到此适配器的行为。

  1. 我们希望继续进行固定费率投票
  2. 我们不希望随时将文件保存在本地目录中,本地目录是云容器位置
  3. 当我们点击一​​个url时,轮询器不应该遵循固定速率轮询(这意味着,不要将文件从远程目录拉到本地目录),但是应该完全处理本地目录中的任何暂存文件
  4. 我们需要另一个处理程序来使用固定费率轮询启动轮询器
  5. 修改适配器以实现此目的的任何建议都是有帮助的。

1 个答案:

答案 0 :(得分:0)

要实现此目的,请将适配器的输出通道设置为nullChannel

添加<file:inbound-channel-adapter/>以轮询本地目录。

停止ftp适配器的轮询器,远程提取将停止(在当前轮询完成后,如果正在进行中),但文件适配器将继续轮询本地目录。

要停止/启动ftp适配器,请@Autowired SourcePollingChannelAdapter或使用控制总线。