camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From diwakar <diwakar.j...@nsn.com>
Subject Re: Dynamic URI creation in apache camel
Date Mon, 12 Dec 2011 11:18:40 GMT
Hi, 

           Please see the route below:
from("ftp://test@localhost/?password=test&binary=true&delay=10000")
	.to("file://target/test-reports");
          Can someone comment on how password hardcoding can be avoided in
the DSL.
          I could avoid it with bean code as below:
    public void getFTPFile(Exchange exchange) {
		ConsumerTemplate consumer =
exchange.getContext().createConsumerTemplate();
		ProducerTemplate prod = exchange.getContext().createProducerTemplate();
		Exchange exchange1;
		while (true)
		{
		 exchange1 =
consumer.receive("ftp://test@localhost/?password="+exchange.getIn().getHeaders().get("pwd")+"&fileName=test.xml&binary=true",
3000);
		System.out.println("getFtp Exchange:"+exchange1);
		if (exchange1 == null)
		{
			System.out.println("getFtp Exchange:"+"break");
			break;
		}
		             prod.send("file://target/test-reports",exchange1);
		}

    }

With Best Regards,
Diwakar


--
View this message in context: http://camel.465427.n5.nabble.com/Dynamic-URI-creation-in-apache-camel-tp5055155p5067964.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message