camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Charles <>
Subject Re: Dynamically configuring FTP component from Exchange input msg?
Date Mon, 27 Aug 2012 18:18:43 GMT

Thanks a lot for the suggestion.  If I wanted to express this flow in Spring DSL, I assume
I would need to create a custom producer template ans refer to that via a <template/>
tag, yes?  

Thanks again,


----- Original Message -----
From: Graham Little <>
To: "" <>
Sent: Friday, August 24, 2012 5:37 PM
Subject: RE: Dynamically configuring FTP component from Exchange input msg?

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 + ""+password;


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.



> Date: Fri, 24 Aug 2012 08:29:10 -0700
> From:
> Subject: Dynamically configuring FTP component from Exchange input msg?
> To:
> 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

View raw message