Spring integration Spring integration DSL无法使用java 1.7中的Sftp入站适配器复制文件

Spring integration Spring integration DSL无法使用java 1.7中的Sftp入站适配器复制文件,spring-integration,Spring Integration,在测试我的Sftp入站流后,我发现当我的本地目录为空时,远程目录中的所有文件都会成功复制到我的本地目录中,但如果本地目录中至少存在一个文件,则不会从远程目录复制任何文件。所以,可以任何一个请提供任何指向它的指针,因为我无法修复它 这是我的Sftp入站流 @Bean public IntegrationFlow sftpInboundFlow() { return IntegrationFlows .from(Sftp.inboundAdapter(this.sft

在测试我的Sftp入站流后,我发现当我的本地目录为空时,远程目录中的所有文件都会成功复制到我的本地目录中,但如果本地目录中至少存在一个文件,则不会从远程目录复制任何文件。所以,可以任何一个请提供任何指向它的指针,因为我无法修复它

这是我的Sftp入站流

@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();
}

请回答以下问题:1。您是否在同一测试迭代中遇到问题,或者在第二次测试之前停止了应用程序?2.该现有文件是来自SFTP的文件之一吗?4.共享
org.springframework.integration
的调试日志,用于错误情况。嗨,我已经为Sftp ibound适配器创建了一个单独的类。当我在Junit上运行这个时,同样的问题也会出现。无论文件是什么,SFTP的现有文件以及任何新文件中都会出现相同的问题。我已经在我的原始帖子中分享了日志。对你来说,你似乎又遇到了上下文
close()
的问题。查看您的日志:
message====GenericMessage
,然后从
@Junit
测试中退出。你的问题真的没有道理…请回答以下问题:1。您是否在同一测试迭代中遇到问题,或者在第二次测试之前停止了应用程序?2.该现有文件是来自SFTP的文件之一吗?4.共享
org.springframework.integration
的调试日志,用于错误情况。嗨,我已经为Sftp ibound适配器创建了一个单独的类。当我在Junit上运行这个时,同样的问题也会出现。无论文件是什么,SFTP的现有文件以及任何新文件中都会出现相同的问题。我已经在我的原始帖子中分享了日志。对你来说,你似乎又遇到了上下文
close()
的问题。查看您的日志:
message====GenericMessage
,然后从
@Junit
测试中退出。真的你的问题没有意义。。。
@Test
public void testSftpInboundFlow() {

    Message<?> message = ((PollableChannel) sftpInboundResultChannel).receive(60000);
    System.out.println("message====" + message);        
}
INFO: Authentication succeeded (password).
enter sftpSessionFactory.....org.springframework.integration.sftp.session.SftpSession@10cea2e
enter sftpInboundFlow.....org.springframework.integration.sftp.session.SftpSession@17ebea9
Jul 16, 2015 6:43:21 PM org.springframework.context.support.DefaultLifecycleProcessor start
INFO: Starting beans in phase -2147483648
Jul 16, 2015 6:43:21 PM org.springframework.context.support.DefaultLifecycleProcessor start
INFO: Starting beans in phase 0
Jul 16, 2015 6:43:21 PM org.springframework.integration.endpoint.EventDrivenConsumer logComponentSubscriptionEvent
INFO: Adding {logging-channel-adapter:_org.springframework.integration.errorLogger} as a subscriber to the 'errorChannel' channel
Jul 16, 2015 6:43:21 PM org.springframework.integration.channel.PublishSubscribeChannel adjustCounterIfNecessary
INFO: Channel 'org.springframework.context.support.GenericApplicationContext@13fb256.errorChannel' has 1 subscriber(s).
Jul 16, 2015 6:43:21 PM org.springframework.integration.endpoint.EventDrivenConsumer start
INFO: started _org.springframework.integration.errorLogger
Jul 16, 2015 6:43:21 PM org.springframework.context.support.DefaultLifecycleProcessor start
INFO: Starting beans in phase 1073741823
Jul 16, 2015 6:43:21 PM org.springframework.integration.endpoint.SourcePollingChannelAdapter start
INFO: started sftpInboundAdapter
Jul 16, 2015 6:43:21 PM org.springframework.integration.file.FileReadingMessageSource receive
INFO: Created message: [GenericMessage [payload=D:\local_copy\Test_sftp.txt, headers={timestamp=1437052401259, id=7e6054ea-9fbc-e9f0-b3e2-9c5dede1556a}]]
the channel is sftpInboundResultChannel
the sftpInboundAdapter is org.springframework.integration.dsl.sftp.SftpInboundChannelAdapterSpec@8df4ff
message====GenericMessage [payload=D:\local_copy\Test_sftp.txt, headers={timestamp=1437052401259, id=7e6054ea-9fbc-e9f0-b3e2-9c5dede1556a}]
Jul 16, 2015 6:43:21 PM org.springframework.context.support.GenericApplicationContext doClose
INFO: Closing org.springframework.context.support.GenericApplicationContext@13fb256: startup date [Thu Jul 16 18:43:10 IST 2015]; root of context hierarchy
Jul 16, 2015 6:43:21 PM org.springframework.context.support.DefaultLifecycleProcessor stop
INFO: Stopping beans in phase 1073741823
Jul 16, 2015 6:43:21 PM org.springframework.integration.endpoint.SourcePollingChannelAdapter stop
INFO: stopped sftpInboundAdapter
Jul 16, 2015 6:43:21 PM org.springframework.context.support.DefaultLifecycleProcessor stop
INFO: Stopping beans in phase 0
Jul 16, 2015 6:43:21 PM org.springframework.integration.endpoint.EventDrivenConsumer logComponentSubscriptionEvent
INFO: Removing {logging-channel-adapter:_org.springframework.integration.errorLogger} as a subscriber to the 'errorChannel' channel
Jul 16, 2015 6:43:21 PM org.springframework.integration.channel.PublishSubscribeChannel adjustCounterIfNecessary
INFO: Channel 'org.springframework.context.support.GenericApplicationContext@13fb256.errorChannel' has 0 subscriber(s).
Jul 16, 2015 6:43:21 PM org.springframework.integration.endpoint.EventDrivenConsumer stop
INFO: stopped _org.springframework.integration.errorLogger
Jul 16, 2015 6:43:21 PM org.springframework.context.support.DefaultLifecycleProcessor stop
INFO: Stopping beans in phase -2147483648
Jul 16, 2015 6:43:21 PM org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler shutdown
INFO: Shutting down ExecutorService 'taskScheduler'