Sftp polling until remote file available #3849
-
| Hi trying to figure out how to wait until remote sftp file is available with a timeout. Was thinking using inbound channel adapter with message gateway , but not sure how it can be achieved. | 
Beta Was this translation helpful? Give feedback.
      
      
          Answered by
          
            oxcafedead
          
      
      
        Jul 15, 2022 
      
    
    Replies: 1 comment 2 replies
-
| Hi @af6140 Specifically this bean definition:     @Bean
    @InboundChannelAdapter(channel = "sftpChannel", poller = @Poller(fixedDelay = "5000"))
    public MessageSource<File> sftpMessageSource() {
        SftpInboundFileSynchronizingMessageSource source =
                new SftpInboundFileSynchronizingMessageSource(sftpInboundFileSynchronizer());
        source.setLocalDirectory(new File("sftp-inbound"));
        source.setAutoCreateLocalDirectory(true);
        source.setLocalFilter(new AcceptOnceFileListFilter<File>());
        source.setMaxFetchSize(1);
        return source;
    }It should do what you have described if I understand your request correctly. | 
Beta Was this translation helpful? Give feedback.
                  
                    2 replies
                  
                
            
      Answer selected by
        artembilan
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Hi @af6140
Please take a look at https://docs.spring.io/spring-integration/reference/html/sftp.html#configuring-with-java-configuration
Specifically this bean definition: