Fix (S)FTP Java/DSL Config
JIRA: https://jira.spring.io/browse/INT-4184
Polishing
(cherry picked from commit cc9d825)
This commit is contained in:
committed by
Artem Bilan
parent
e8eecc7d8f
commit
21ee3c2259
@@ -354,13 +354,13 @@ public class FtpJavaApplication {
|
||||
public FtpInboundFileSynchronizer ftpInboundFileSynchronizer() {
|
||||
FtpInboundFileSynchronizer fileSynchronizer = new FtpInboundFileSynchronizer(ftpSessionFactory());
|
||||
fileSynchronizer.setDeleteRemoteFiles(false);
|
||||
fileSynchronizer.setRemoteDirectory("/");
|
||||
fileSynchronizer.setRemoteDirectory("foo");
|
||||
fileSynchronizer.setFilter(new FtpSimplePatternFileListFilter("*.xml"));
|
||||
return fileSynchronizer;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@InboundChannelAdapter(channel = "ftpChannel")
|
||||
@InboundChannelAdapter(channel = "ftpChannel", poller = @Poller(fixedDelay = "5000"))
|
||||
public MessageSource<File> ftpMessageSource() {
|
||||
FtpInboundFileSynchronizingMessageSource source =
|
||||
new FtpInboundFileSynchronizingMessageSource(ftpInboundFileSynchronizer());
|
||||
@@ -406,11 +406,13 @@ public class FtpJavaApplication {
|
||||
return IntegrationFlows
|
||||
.from(s -> s.ftp(this.ftpSessionFactory)
|
||||
.preserveTimestamp(true)
|
||||
.remoteDirectory("ftpSource")
|
||||
.remoteDirectory("foo")
|
||||
.regexFilter(".*\\.txt$")
|
||||
.localFilename(f -> f.toUpperCase() + ".a")
|
||||
.localDirectory(new File("d:\ftp_files")),
|
||||
e -> e.id("ftpInboundAdapter").autoStartup(false))
|
||||
.localDirectory(new File("d:\\ftp_files")),
|
||||
e -> e.id("ftpInboundAdapter")
|
||||
.autoStartup(true)
|
||||
.poller(Pollers.fixedDelay(5000)))
|
||||
.handle(m -> System.out.println(m.getPayload()))
|
||||
.get();
|
||||
}
|
||||
|
||||
@@ -463,17 +463,17 @@ public class SftpJavaApplication {
|
||||
public SftpInboundFileSynchronizer sftpInboundFileSynchronizer() {
|
||||
SftpInboundFileSynchronizer fileSynchronizer = new SftpInboundFileSynchronizer(sftpSessionFactory());
|
||||
fileSynchronizer.setDeleteRemoteFiles(false);
|
||||
fileSynchronizer.setRemoteDirectory("/");
|
||||
fileSynchronizer.setRemoteDirectory("foo");
|
||||
fileSynchronizer.setFilter(new SftpSimplePatternFileListFilter("*.xml"));
|
||||
return fileSynchronizer;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@InboundChannelAdapter(channel = "sftpChannel")
|
||||
@InboundChannelAdapter(channel = "sftpChannel", poller = @Poller(fixedDelay = "5000"))
|
||||
public MessageSource<File> sftpMessageSource() {
|
||||
SftpInboundFileSynchronizingMessageSource source =
|
||||
new SftpInboundFileSynchronizingMessageSource(sftpInboundFileSynchronizer());
|
||||
source.setLocalDirectory(new File("ftp-inbound"));
|
||||
source.setLocalDirectory(new File("sftp-inbound"));
|
||||
source.setAutoCreateLocalDirectory(true);
|
||||
source.setLocalFilter(new AcceptOnceFileListFilter<File>());
|
||||
return source;
|
||||
@@ -514,12 +514,14 @@ public class SftpJavaApplication {
|
||||
public IntegrationFlow sftpInboundFlow() {
|
||||
return IntegrationFlows
|
||||
.from(s -> s.sftp(this.sftpSessionFactory)
|
||||
.preserveTimestamp(true)
|
||||
.remoteDirectory("sftpSource")
|
||||
.regexFilter(".*\\.txt$")
|
||||
.localFilenameExpression("#this.toUpperCase() + '.a'")
|
||||
.localDirectory(this.sftpServer.getTargetLocalDirectory()),
|
||||
e -> e.id("sftpInboundAdapter").autoStartup(false))
|
||||
.preserveTimestamp(true)
|
||||
.remoteDirectory("foo")
|
||||
.regexFilter(".*\\.txt$")
|
||||
.localFilenameExpression("#this.toUpperCase() + '.a'")
|
||||
.localDirectory(new File("sftp-inbound")),
|
||||
e -> e.id("sftpInboundAdapter")
|
||||
.autoStartup(true)
|
||||
.poller(Pollers.fixedDelay(5000)))
|
||||
.handle(m -> System.out.println(m.getPayload()))
|
||||
.get();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user