Hi Charles,
yes exactly in spring dsl you can refer to producer templates as
follows:<camelContext xmlns="http://camel.apache.org/schema/spring">
<template id="producer"/>
<route>
<from uri="activemq:queue:Endpoint.OUTGOING"/>
<recipientList>
<header>myHeader</header>
</recipientList>
</route>
</camelContext>
Consumer Templates just incase:
<consumerTemplate id="consumer"/>
There is some useful documentation here, especially for implementing strategies
to deal with common issues like stopOnException:
http://camel.apache.org/recipient-list.html
Thanks
Graham
> Date: Mon, 27 Aug 2012 11:18:43 -0700
> From: [email protected]
> Subject: Re: Dynamically configuring FTP component from Exchange input msg?
> To: [email protected]
>
> Graham,
>
> 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,
>
> Charles
>
>
> ----- Original Message -----
> From: Graham Little <[email protected]>
> To: "[email protected]" <[email protected]>
> Cc:
> 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 +
> "@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: [email protected]
> > Subject: Dynamically configuring FTP component from Exchange input msg?
> > To: [email protected]
> >
> > 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