Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring集成JavaDSL:创建sftp入站适配器_Spring_Spring Integration - Fatal编程技术网

Spring集成JavaDSL:创建sftp入站适配器

Spring集成JavaDSL:创建sftp入站适配器,spring,spring-integration,Spring,Spring Integration,我想使用DSL创建一个流。流来自适配器,消息将流到通道 @Bean public IntegrationFlow sftpInboundFlow() { prepareSftpServer(); return IntegrationFlows .from(Sftp.inboundAdapter(this.sftpSessionFactory).getId("SftpInboundAdapter")

我想使用DSL创建一个流。流来自适配器,消息将流到通道

@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的测试示例启动适配器。你能提供任何指向它的指针吗。