I have looked here here and am unable to get listFiles to work:
@Bean
public SessionFactory<LsEntry> sftpSessionFactory() {
DefaultSftpSessionFactory factory = new DefaultSftpSessionFactory(true);
factory.setHost("localhost");
factory.setPort(port);
factory.setUser("foo");
factory.setPassword("foo");
factory.setAllowUnknownKeys(true);
factory.setTestSession(true);
return new CachingSessionFactory<LsEntry>(factory);
}
@MessagingGateway
public interface MyGateway {
@Gateway(requestChannel = "sftpChannel")
List<File> listFiles();
}
@Bean
@ServiceActivator(inputChannel = "sftpChannel")
public MessageHandler handler() {
return new SftpOutboundGateway(ftpSessionFactory(), "ls", "'my_remote_dir/'");
}
where in my @Component class I have this:
@Autowired
MyGateway gateway;
public void list(){
List<File> files = gateway.listFiles();
}
when I run this, I get an error receive is not supported, because no pollable reply channel has been configured
I assume this is an issue with my knowledge/understanding of integration channels. Perhaps I am missing a bean, but my main goal here is to do replace my current use of the inboundchannel adapter to request files ad hoc instead of continuously polling the fileserver