使用SI XML分配id很简单,如下所示
<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="/apps/wfg/ftp/test" auto-startup="true">
<int:poller fixed-rate="1000">
<int:transactional synchronization-factory="syncFactory" />
</int:poller>
</int-ftp:inbound-channel-adapter>
同样可以在dsl代码中完成同样的操作吗?
IntegrationFlow flow = IntegrationFlows
.from(Ftp
.inboundAdapter(csf)
.preserveTimestamp(true)
.remoteDirectory(feed.getRemoteDirectory())
.regexFilter(feed.getRegexFilter())
.deleteRemoteFiles(feed.getDeleteRemoteFiles())
.autoCreateLocalDirectory(
feed.getAutoCreateLocalDirectory())
.localFilenameExpression(
feed.getLocalFilenameExpression()).get();
在这种情况下也可以进行相同的过渡同步。
答案 0 :(得分:1)
IntegrationFlow flow = IntegrationFlows.from(Ftp.inboundAdapter(sessionFactory())
.preserveTimestamp(true)
.remoteDirectory("ftpSource")
.regexFilter(".*\\.txt$")
.localFilename(f -> f.toUpperCase() + ".a")
.localDirectory(getTargetLocalDirectory()),
e -> e.id("ftpInboundAdapter")
.poller(Pollers.fixedDelay(100)
.transactionSynchronizationFactory(syncFactory())))
.channel(out)
.get();