Java 如何使用Spring integration DSL进行Ftp轮询
我正在尝试为下面描述的流创建动态ftp入站适配器Java 如何使用Spring integration DSL进行Ftp轮询,java,spring,spring-integration,Java,Spring,Spring Integration,我正在尝试为下面描述的流创建动态ftp入站适配器 <int-ftp:inbound-channel-adapter id="ftpInbound" channel="ftpChannel" session-factory="ftpClientFactory" filename-pattern="*.txt" auto-create-local-directory="true" delete-remote-files="false" remote-directory=
<int-ftp:inbound-channel-adapter id="ftpInbound"
channel="ftpChannel" session-factory="ftpClientFactory"
filename-pattern="*.txt" auto-create-local-directory="true"
delete-remote-files="false" remote-directory="${remotedir}"
local-directory="/mock/test" auto-startup="true">
<int:poller fixed-rate="1000">
<int:transactional synchronization-factory="syncFactory" />
</int:poller>
</int-ftp:inbound-channel-adapter>
同样的方法也可以很好地工作,但是我还想配置一个类似于上面xml中的动态轮询器。SI Java DSL也可以这样做吗
更新
看起来它可以工作,但不确定为什么它没有出现在内容辅助中
e -> e.poller(Pollers.fixedRate(100).maxMessagesPerPoll(1))
您确定
.from()
中的e
没有.poller()`:
?哇..它很管用…谢谢你,我想它应该管用,但看起来不适合我。好的。版本是什么?如果你把lambda转换成类,它会是什么样子呢?版本是4.3.8,我认为它应该是一个SourcePollingChannelAdapterSpec,嗯,它现在似乎在工作,不知道为什么它从来没有出现在内容辅助中:|很高兴看到你做到了这一点。如果至少能投上一票就好了花时间lol做了件傻事。。。有时不需要依赖IDE的内容帮助
e -> e.poller(Pollers.fixedRate(100).maxMessagesPerPoll(1))
from(Ftp.inboundAdapter(csf)
.preserveTimestamp(true)
.remoteDirectory(feed.getRemoteDirectory())
.regexFilter(".*\\.txt$")
.localDirectory(new File(feed.getLocalDirectory())),
e -> e.id("ftpInboundAdapter" + connection.getId()
+ feed.getId()
.poller())