I'm trying to consume a file from SFTP server that is triggered from a jms
route.
I've dont this successfully via ftp but it is complaining of missing host
parameter when I try consuming from sftp.
Here's my code.
from("activemq:queue:sftpArchive").process(new Processor() {
public void process(final Exchange exchange) throws Exception {
// Get Header properties
Message message = (Message) exchange.getIn();
final String filename = (String) message.getHeader("filename");
String url =
"sftp://test@$127.0.0.1?knownHostsFile=c://known_host&password=pass&binary=true&fileName="
+ filename;
Endpoint endpoint = getContext().getEndpoint(url);
PollingConsumer consumer = endpoint.createPollingConsumer();
consumer.start();
Exchange pollExchange = consumer.receive();
consumer.stop();
exchange.getOut().setBody(pollExchange.getIn().getBody());
exchange.getOut().setHeader(Exchange.FILE_NAME, filename);
}
}) .to("file://c://archive")
I was using camel 2.3.0 and also tried using 2.6.0 with the same error
Inside RemoteFileEndpoint class, config.getHost() is null other properties
are fine.
protected void afterPropertiesSet() throws Exception {
RemoteFileConfiguration config = getConfiguration();
ObjectHelper.notEmpty(config.getHost(), "host");
ObjectHelper.notEmpty(config.getProtocol(), "protocol");
}
Thanks
--
View this message in context:
http://camel.465427.n5.nabble.com/Sftp-component-host-not-set-exception-tp3367778p3367778.html
Sent from the Camel - Users mailing list archive at Nabble.com.