繁体   English   中英

Spring Integration Java DSL:创建sftp入站适配器

[英]Spring integration Java DSL : creating sftp inbound adapter

我想使用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();

没有这样的getId(String)方法。

是的,我将最终修复其JavaDocs,但您实际上遇到了编译错误,因此使用了错误的语言。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM