You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Spalat <su...@nsn.com> on 2011/12/07 11:41:03 UTC

Dynamic URI creation in apache camel

Is it possible to dynamically create a URI in camel FTP?  

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

Re: Dynamic URI creation in apache camel

Posted by diwakar <di...@nsn.com>.
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.

Re: Dynamic URI creation in apache camel

Posted by diwakar <di...@nsn.com>.
Hi, 

             FTP component seems to be mostly a polling consumer.
            
>>ftp://${in.header.username}@${in.header.ip}:21/Newfolder/?password=${in.header.pwd}&
             How can the expansion of the headers ever work for consumers?
             An example would help. Thanks.

With Best Regards,
Diwakar


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

Re: Dynamic URI creation in apache camel

Posted by diwakar <di...@nsn.com>.
Hi, 

                 >> For headers, you will have to avoid outputting those in
logs yourself. 
                 >> Or store as property on Exchange as they are not logged
by default
                 If Camel code does not log the headers (even with DEBGUG
level) it is fine. 
                 Thanks.

With Best Regards,
Diwakar


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

Re: Dynamic URI creation in apache camel

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Dec 8, 2011 at 10:37 AM, diwakar <di...@nsn.com> wrote:
> Hi,
>
>             >> Camel will by default mask passwords when it logs
> endpoints/messages etc.
>             Is there any naming convention for the pwd headers. Otherwise
> how will Camel know that a particular header contains password.
>             Please let me know your comment.
>

Its only for endpoint and components where it knows by naming pattern.
So if an option is named password, its masked etc.

For headers, you will have to avoid outputting those in logs yourself.
Or encrypt the password.

Or store as property on Exchange as they are not logged by default.


> With Best Regards,
> Diwakar
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Dynamic-URI-creation-in-apache-camel-tp5055155p5058217.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: Dynamic URI creation in apache camel

Posted by diwakar <di...@nsn.com>.
Hi, 

             >> Camel will by default mask passwords when it logs
endpoints/messages etc. 
             Is there any naming convention for the pwd headers. Otherwise
how will Camel know that a particular header contains password. 
             Please let me know your comment.

With Best Regards,
Diwakar


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

Re: Dynamic URI creation in apache camel

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Dec 8, 2011 at 7:01 AM, Spalat <su...@nsn.com> wrote:
> Hi,
>
>           Thanks for the reply.
>           So we can use
> ...ftp://${in.header.username}@${in.header.ip}:21/Newfolder/?password=${in.header.pwd}&amp;recursive=true&amp...
>           For password is there a security subject for the
> message/exchange? To void the pwd being traced in some logs.
>

No there is no special security subject.

Camel will by default mask passwords when it logs endpoints/messages etc.
You can remove the header after the ftp endpoint, so it wont be
propagated further in the processing.

There is a camel-jasypt component to support encrypted values/passwords etc
http://camel.apache.org/jasypt
> With Best Regards,
> spalat
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Dynamic-URI-creation-in-apache-camel-tp5055155p5057775.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: Dynamic URI creation in apache camel

Posted by Spalat <su...@nsn.com>.
Hi, 

           Thanks for the reply.
           So we can use
...ftp://${in.header.username}@${in.header.ip}:21/Newfolder/?password=${in.header.pwd}&amp;recursive=true&amp...
           For password is there a security subject for the
message/exchange? To void the pwd being traced in some logs.

With Best Regards,
spalat

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

Re: Dynamic URI creation in apache camel

Posted by Claus Ibsen <cl...@gmail.com>.
See this FAQ
http://camel.apache.org/how-do-i-use-dynamic-uri-in-to.html

And you may want to use the disconnect=true option on the FTP uri, to
logout after usage.



On Wed, Dec 7, 2011 at 11:51 AM, Spalat <su...@nsn.com> wrote:
> I'm using camel-context.xml to construct FTP endpoints . Currently i'm
> hardcoding the username and password in the FTP uri . Is it possible to
> change them in the FTP uri dynamically on each request. ?
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Dynamic-URI-creation-in-apache-camel-tp5055155p5055182.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

RE: Dynamic URI creation in apache camel

Posted by Justin Rosenberg <Ro...@crlcorp.com>.
You can programmatically stop the route, update the DSL, and start the
route again.  I'm not sure how to change the parameters after the route
has started.

~Justin


-----Original Message-----
From: Spalat [mailto:suchitra.palat@nsn.com] 
Sent: Wednesday, December 07, 2011 4:51 AM
To: users@camel.apache.org
Subject: Re: Dynamic URI creation in apache camel

I'm using camel-context.xml to construct FTP endpoints . Currently i'm
hardcoding the username and password in the FTP uri . Is it possible to
change them in the FTP uri dynamically on each request. ?

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

CONFIDENTIALITY NOTICE:
The information in this message, and any attachment, is intended for the 
sole use of the individual and entity to whom it is addressed. This 
information may be privileged, confidential, and protected from 
disclosure. If you are not the intended recipient you are hereby notified 
that you have received this communication in error and that any review, 
disclosure, dissemination, distribution or copying of it, or its contents, 
is strictly prohibited. If you think that you have received this message 
in error please notify the sender and destroy all copies of this 
communication and any attachments. Thank you.

Re: Dynamic URI creation in apache camel

Posted by Spalat <su...@nsn.com>.
I'm using camel-context.xml to construct FTP endpoints . Currently i'm
hardcoding the username and password in the FTP uri . Is it possible to
change them in the FTP uri dynamically on each request. ?

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