I am trying to create Dynamic ftp inbound adapters for the flow described below
<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>
To do this I have created the below flows with SI java dsl that I register using SI dynamic registration as below
public void createSubFlows(FtpConfig config) {
DefaultFtpSessionFactory sf = new DefaultFtpSessionFactory();
Connection connection = config.getConnection();
Feed feed = config.getFeed();
sf.setHost(connection.getHost());
sf.setPort(connection.getPort());
sf.setUsername(connection.getUsername());
sf.setPassword(connection.getPassword());
IntegrationFlow flow = IntegrationFlows
.from(Ftp.inboundAdapter(csf).preserveTimestamp(true)
.remoteDirectory(feed.getRemoteDirectory())
.regexFilter(".*\\.txt$")
.localDirectory(new File(feed.getLocalDirectory())),
e -> e.id("ftpInboundAdapter" + connection.getId()
+ feed.getId())//
).handle(m -> System.out.println(m.getPayload())).get();
this.flowContext.registration(flow)
.id("ftp.flow" + connection.getId() + feed.getId()).autoStartup(true)
.register();
}
The same works well but I wanted to also configure a dynamic poller similar to the one in the xml above . Is it possible to do the same with SI Java DSL
UPDATE
Looks like it works though not sure why it doesnt come in the content assist
e -> e.poller(Pollers.fixedRate(100).maxMessagesPerPoll(1))
Are you sure that e
in the .from()
doesn't have .poller()`:
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())
?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.