camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Graham Little <graham.lit...@outlook.com>
Subject RE: Dynamically configuring FTP component from Exchange input msg?
Date Fri, 24 Aug 2012 21:37:40 GMT
Hi Charles, 

Yes this is possible, you can get the value from either the header or the body content as
you prefer and then you can use the recipientlist to create the dynamic endpoint. You could
use something a little like this:

Processor ftpProcesor = new Processor () {
public void process(Exchange exchange) throws Exception {
Message in = exchange.getIn();

String username = in.getHeader("FTP_USR_NM", String.class);
String password = in.getHeader("FTP_PASSWORD", String.class);

ftpEndpointURL = "ftp://" + username + "@ftpserver.ftp.com:22/Test?password="+password;
}
}

from("activemq:queue:ftp.OUTGOING)
.process(ftpProcesor)
.recipientList(ftpEndpointURL)

You could also pass all of the username/password values in at once in a comma separated list,
or xml file or some other format and then loop through each pair and then perform the FTP
operations as you go.

Hope this helps.

Thanks

Graham

> Date: Fri, 24 Aug 2012 08:29:10 -0700
> From: cw94114@yahoo.com
> Subject: Dynamically configuring FTP component from Exchange input msg?
> To: users@camel.apache.org
> 
> I have a requirement to perform FTP operations on behalf of 100's of parties, all of
which have their own FTP credentials.  Obviously, it would not be practical to configure 100's
of instances of the FTP component with different user's login/password hardcoded in the URI.
 I am wondering if there's a way for the FTP component to pull the user/password from the
message payload or headers?
> 
> Thanks
 		 	   		  
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message