Spring integration Spring集成DSL在java 1.7中创建Sftp入站适配器

Spring integration Spring集成DSL在java 1.7中创建Sftp入站适配器,spring-integration,Spring Integration,我正在SpringDSL中创建一个sftp入站流,但是当我试图在junit中测试它时,mesage将为空。我认为sftp ibound适配器没有正确启动,但不确定。所以我不能再进一步了。由于我无法继续,请提供任何指向它的指针 这是我的流程 @Bean public IntegrationFlow sftpInboundFlow() { return IntegrationFlows .from(Sftp.inboundAdapter

我正在SpringDSL中创建一个sftp入站流,但是当我试图在junit中测试它时,mesage将为空。我认为sftp ibound适配器没有正确启动,但不确定。所以我不能再进一步了。由于我无法继续,请提供任何指向它的指针

这是我的流程

    @Bean
    public IntegrationFlow sftpInboundFlow() {
        return IntegrationFlows
                .from(Sftp.inboundAdapter(this.sftpSessionFactory)
                        .preserveTimestamp(true).remoteDirectory(remDir)
                        .regexFilter(".*\\.txt$")
                        .localFilenameExpression("#this.toUpperCase()")
                        .localDirectory(new File(localDir))
                        .remoteFileSeparator("/"),
                        new Consumer<SourcePollingChannelAdapterSpec>() {
                            @Override
                            public void accept(
                                    SourcePollingChannelAdapterSpec e) {
                                e.id("sftpInboundAdapter")
                                        .autoStartup(true)
                                        .poller(Pollers.fixedRate(1000)
                                                .maxMessagesPerPoll(1));
                            }
                        })
                .channel(MessageChannels.queue("sftpInboundResultChannel"))
                .get();
    }
这是我的民意频道

    @Autowired
        private PollableChannel sftpInboundResultChannel;   

    @Bean
        public PollableChannel sftpChannel() {
        return new QueueChannel();
    }
这是我的测试方法

    @Test
    public void testSftpInboundFlow() {

        Message<?> message = ((PollableChannel) sftpInboundResultChannel).receive(1000);     //Not receiving any message
        System.out.println("message====" + message);
        Object payload = message.getPayload();

        File file = (File) payload;
        message = this.sftpInboundResultChannel.receive(1000);
        file = (File) message.getPayload(); 

    }   
@测试
公共void testSftpInboundFlow(){
Message Message=((PollableChannel)sftpInboundResultChannel).receive(1000);//未接收任何消息
System.out.println(“message==”+message);
对象负载=message.getPayload();
文件=(文件)有效载荷;
message=this.sftpInboundResultChannel.receive(1000);
file=(file)message.getPayload();
}   

打开调试日志记录,查找端点开始日志消息和轮询活动。如果没有,请发布完整的启动日志(调试所有
org.springframework
)。在这里它可能太大了,所以请使用pastebin或github gist或类似工具。您的
@Configuration
类上是否有
@EnableIntegration
?如何增加测试中的“receiveTimeout”,因为它现在与“fixedRate”相同?因此,没有足够的时间等待channelHI Artem中的某些内容,我添加了@EnableIntegration并增加了“receiveTimeout”,现在我的代码正在工作。非常感谢您的宝贵评论。嗨,Artem,我发现当我的本地目录为空时,远程目录中的所有文件都会成功复制到我的本地目录中,但如果本地目录中存在一些文件,则不会从远程目录复制任何文件。因此,请您就此向我提供建议。打开调试日志记录并查找端点开始日志消息和轮询活动。如果没有,请发布完整的启动日志(调试所有
org.springframework
)。在这里它可能太大了,所以请使用pastebin或github gist或类似工具。您的
@Configuration
类上是否有
@EnableIntegration
?如何增加测试中的“receiveTimeout”,因为它现在与“fixedRate”相同?因此,没有足够的时间等待channelHI Artem中的某些内容,我添加了@EnableIntegration并增加了“receiveTimeout”,现在我的代码正在工作。非常感谢您的宝贵评论。嗨,Artem,我发现当我的本地目录为空时,远程目录中的所有文件都会成功复制到我的本地目录中,但如果本地目录中存在一些文件,则不会从远程目录复制任何文件。你能给我一些建议吗。
    @Test
    public void testSftpInboundFlow() {

        Message<?> message = ((PollableChannel) sftpInboundResultChannel).receive(1000);     //Not receiving any message
        System.out.println("message====" + message);
        Object payload = message.getPayload();

        File file = (File) payload;
        message = this.sftpInboundResultChannel.receive(1000);
        file = (File) message.getPayload(); 

    }