我们使用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>
以下是我们需要添加到此适配器的行为。
修改适配器以实现此目的的任何建议都是有帮助的。
答案 0 :(得分:0)
要实现此目的,请将适配器的输出通道设置为nullChannel
。
添加<file:inbound-channel-adapter/>
以轮询本地目录。
停止ftp适配器的轮询器,远程提取将停止(在当前轮询完成后,如果正在进行中),但文件适配器将继续轮询本地目录。
要停止/启动ftp适配器,请@Autowired
SourcePollingChannelAdapter
或使用控制总线。