Is there a way to start the file:inbound-channel-adapter through code?(有没有办法通过代码启动文件:inbound-Channel-Adapter?)
本文介绍了有没有办法通过代码启动文件:inbound-Channel-Adapter?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我遇到了将特定文件从一个位置复制到另一个位置的情况。轮询不是必需的,因为该操作将被故意触发。此外,在运行时决定从中选取文件的目录。我可以进行如下配置:
<int-file:inbound-channel-adapter id="filesIn" directory="@outPathBean.getPath()" channel="abc" filter="compositeFilter" >
<int:poller id="poller" fixed-delay="5000" />
</int-file:inbound-channel-adapter>
<int:channel id="abc"/>
<int-file:outbound-channel-adapter channel="abc" id="filesOut"
directory-expression="file:${paths.root}"
delete-source-files="true" filename-generator="fileNameGenerator" />
还配置了文件名生成器和复合筛选器类。
我对春天不熟悉。请给我指出正确的方向!!
推荐答案
您可以使用this answer中讨论的FireOnceTrigger
,并根据需要启动/停止适配器。
获取对适配器的引用(aSourcePollingChannelAdapter
)、插入(或@Autowire
等。)它作为Lifecycle
Bean(start()
/stop()
等)。
或者您可以使用FileReadingMessageSource
以编程方式完成整个操作,如this answer中所述。
这篇关于有没有办法通过代码启动文件:inbound-Channel-Adapter?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
织梦狗教程
本文标题为:有没有办法通过代码启动文件:inbound-Channel-Adapter?


基础教程推荐
猜你喜欢
- 修改 void 函数的输入参数,然后读取 2022-01-01
- Struts2 URL 无法访问 2022-01-01
- RabbitMQ:消息保持“未确认"; 2022-01-01
- 存储 20 位数字的数据类型 2022-01-01
- Spring AOP错误无法懒惰地为此建议构建thisJoinPoin 2022-09-13
- 问题http://apache.org/xml/features/xinclude测试日志4j 2 2022-01-01
- REST Web 服务返回 415 - 不支持的媒体类型 2022-01-01
- 如何对 Java Hashmap 中的值求和 2022-01-01
- 使用堆栈算法进行括号/括号匹配 2022-01-01
- 无法复制:“比较方法违反了它的一般约定!" 2022-01-01