You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Atanas Shindov <at...@gmail.com> on 2014/11/22 19:13:00 UTC

FTP Component configuration

Hi guys,

After I've watched the  Riding Camel
<https://skillsmatter.com/skillscasts/2450-riding-camel>   presentation by
James Strachan I tried to implement a route where all endpoints are FTP
based, but instead of configuring each FTP endpoint with hostname, port, and
login credentials, I wanted to configure all this just once on a
FtpComponent and have all these configurations automatically applied to all
my endpoints created with this component. I imagined that Camel would allow
me to do something like this:

FtpComponentConfiguration config = new FtpComponentConfiguration();
config.setHostname("localhost");
config.setPort("21");
config.setUsername("user");
config.setPassword("password");
FtpComponent ftp = new FtpComponent(config);

context.addComponent("myFtp", ftp);

And then my route's DSL would look like this:

from(myFtp://directory/fromDirectory).to(myFtp://directory/toDirectory);

However, it looks like that Camel's FTP component can't be used like this
(or at least I can't find a way to do it) which is very strange considering
the fact that James used namely FTP as an example to explain the idea behind
the components. I've used this approach for JMS - you configure a JMS
component just once with that's necessary (e.g. connection factory), and
then refer it in each JMS endpoint.

Am I missing something or the current implementation of FTP does not allow
this?

Best regards,
Atanas



--
View this message in context: http://camel.465427.n5.nabble.com/FTP-Component-configuration-tp5759497.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: FTP Component configuration

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

No you cannot do that, you need to set the host/port etc in the uri,
when you define the endpoint as an uri string.




On Sat, Nov 22, 2014 at 7:13 PM, Atanas Shindov
<at...@gmail.com> wrote:
> Hi guys,
>
> After I've watched the  Riding Camel
> <https://skillsmatter.com/skillscasts/2450-riding-camel>   presentation by
> James Strachan I tried to implement a route where all endpoints are FTP
> based, but instead of configuring each FTP endpoint with hostname, port, and
> login credentials, I wanted to configure all this just once on a
> FtpComponent and have all these configurations automatically applied to all
> my endpoints created with this component. I imagined that Camel would allow
> me to do something like this:
>
> FtpComponentConfiguration config = new FtpComponentConfiguration();
> config.setHostname("localhost");
> config.setPort("21");
> config.setUsername("user");
> config.setPassword("password");
> FtpComponent ftp = new FtpComponent(config);
>
> context.addComponent("myFtp", ftp);
>
> And then my route's DSL would look like this:
>
> from(myFtp://directory/fromDirectory).to(myFtp://directory/toDirectory);
>
> However, it looks like that Camel's FTP component can't be used like this
> (or at least I can't find a way to do it) which is very strange considering
> the fact that James used namely FTP as an example to explain the idea behind
> the components. I've used this approach for JMS - you configure a JMS
> component just once with that's necessary (e.g. connection factory), and
> then refer it in each JMS endpoint.
>
> Am I missing something or the current implementation of FTP does not allow
> this?
>
> Best regards,
> Atanas
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/FTP-Component-configuration-tp5759497.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Re: FTP Component configuration

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Yeah it can be a good idea for the ftp to support also, you are
welcome to log a JIRA and work on a patch with test.

On Tue, Nov 25, 2014 at 2:57 PM, Atanas Shindov
<at...@gmail.com> wrote:
> That's also my understanding. We could have a behavior similar to camel-jms:
> do the configuration once on the component level - connection factory, JNDI
> configurations if necessary, etc., and have it reused by each endpoint
> instance create with the component.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/FTP-Component-configuration-tp5759497p5759590.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Re: FTP Component configuration

Posted by Atanas Shindov <at...@gmail.com>.
That's also my understanding. We could have a behavior similar to camel-jms:
do the configuration once on the component level - connection factory, JNDI
configurations if necessary, etc., and have it reused by each endpoint
instance create with the component.



--
View this message in context: http://camel.465427.n5.nabble.com/FTP-Component-configuration-tp5759497p5759590.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: FTP Component configuration

Posted by Claus Ibsen <cl...@gmail.com>.
Because not many do like you.

And the ftp component parses the uri to grab the host / port etc. The
latter can be fixed though, and thus would require code changes in
camel-ftp.

Other components may work fine. Its more special case for the ftp that
it looks for the host/port from the uri.



On Tue, Nov 25, 2014 at 1:57 PM, Atanas Shindov
<at...@gmail.com> wrote:
> Hi Claus and fidoedidoe,
>
> thanks for your answers. I was more interested in why the component is
> designed like this from a conceptual point of view, otherwise - yes, using
> the properties component would allow me to achieve the same effect.
>
> Thanks again.
>
> Best regards,
> Atanas
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/FTP-Component-configuration-tp5759497p5759584.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Re: FTP Component configuration

Posted by Atanas Shindov <at...@gmail.com>.
Hi Claus and fidoedidoe,

thanks for your answers. I was more interested in why the component is
designed like this from a conceptual point of view, otherwise - yes, using
the properties component would allow me to achieve the same effect.

Thanks again.

Best regards,
Atanas



--
View this message in context: http://camel.465427.n5.nabble.com/FTP-Component-configuration-tp5759497p5759584.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: FTP Component configuration

Posted by fidoedidoe <ga...@sagepub.co.uk>.
I'm no expert, but could the use of  propertyPlaceholder
<http://camel.apache.org/using-propertyplaceholder.html>  help achieve
similar results (define the FTP details once) and use many?? 



--
View this message in context: http://camel.465427.n5.nabble.com/FTP-Component-configuration-tp5759497p5759583.html
Sent from the Camel - Users mailing list archive at Nabble.com.