Spring集成JavaDSL:创建sftp入站适配器
我想使用DSL创建一个流。流来自适配器,消息将流到通道Spring集成JavaDSL:创建sftp入站适配器,spring,spring-integration,Spring,Spring Integration,我想使用DSL创建一个流。流来自适配器,消息将流到通道 @Bean public IntegrationFlow sftpInboundFlow() { prepareSftpServer(); return IntegrationFlows .from(Sftp.inboundAdapter(this.sftpSessionFactory).getId("SftpInboundAdapter")
@Bean
public IntegrationFlow sftpInboundFlow() {
prepareSftpServer();
return IntegrationFlows
.from(Sftp.inboundAdapter(this.sftpSessionFactory).getId("SftpInboundAdapter")
.preserveTimestamp(true)
.remoteDirectory("sftpSource")
.regexFilter(".*\\.txt$")
.localFilenameExpression("#this.toUpperCase() + '.a'").localDirectory(file).channel(MessageChannels.queue("sftpInboundResultChannel"))
.get());
}
不确定getId()方法是否存在编译错误。试图从Java 8 lambda转换为Java 7我想您需要为组件添加一个
id
属性,以便在应用程序上下文中使用该bean名称注册它。您的配置必须如下所示:
return IntegrationFlows
.from(Sftp.inboundAdapter(this.sftpSessionFactory)
.preserveTimestamp(true)
.remoteDirectory("sftpSource")
.regexFilter(".*\\.txt$")
.localFilenameExpression("#this.toUpperCase() + '.a'")
.localDirectory(file),
new Consumer<SourcePollingChannelAdapterSpec>() {
@Override
public void accept(SourcePollingChannelAdapterSpec e) {
e.id("SftpInboundAdapter");
}
})
.channel(MessageChannels.queue("sftpInboundResultChannel"))
.get();
返回集成流
.from(Sftp.inboundAdapter(此.sftpSessionFactory)
.保留时间戳(true)
.remoteDirectory(“sftpSource”)
.regexFilter(“.\\.txt$”)
.localFilenameExpression(“#this.toUpperCase()+'.a'))
.localDirectory(文件),
新消费者(){
@凌驾
公共无效接受(SourcePollingChannelAdapterSpec e){
e、 id(“SftpInboundAdapter”);
}
})
.channel(MessageChannels.queue(“sftpInboundResultChannel”))
.get();
没有这样的getId(String)
方法
是的,我最终会修复它的JavaDocs,但您确实面临编译错误,因此使用了错误的语言。Hi Artem,我能够消除编译错误并编写适配器,但无法在spring integration DSL中使用S FTP的测试示例启动适配器。你能提供任何指向它的指针吗。