Sorry for my quick response regarding the documentation. (1) Your example in Spring DSL works also when applying the Java DSL, It's just about the endpoint configuration, respectively the String parameter you are passing (2) May I try to summarize what you are trying
a) Send a file to FTP server 1 and store it there b) Some magic changes the file on that server and you need to get it back? You therefore simply wait for some time and than pull the document If that's the case, there might be a better option of what you want to achieve. Please take a look into e.g. something like AggregationStrategy. This might enable you to have two different routes and combine them, even with the same file name. You can do it of course always also via the bean construct. But if you want to utilize more of the Camel code, you probably need to go down somewhere like that. Hope this helps. - Christoph On May 11, 2013, at 4:44 PM, Bruno Dusausoy wrote: > On 05/11/2013 04:14 PM, Christoph Emmersberger wrote: >> Well here is the documentation: http://camel.apache.org/ftp.html >> >> (1) Add the maven dependency to your project >> (2) Configure your endpoints (there are some parameters you can set as >> parameters, please refer to the documentation) >> > > Thanks for pointing me to the docs but I already know them. > I also own a copy of Camel in Action. > > Maybe I don't explain myself clearly, I apologise for that. > > What I was doing in the first place was actually working fine : I just asked > if it could be less ugly and if I could get rid of the consumer and producer > templates easily. > > Now I've configured my endpoints, or at least one of them, with Spring DSL > like this : > > <camel:camelContext xmlns="http://camel.apache.org/schema/spring"> > <endpoint id="ftpIn" > uri="ftp://${user}@${hostname}:${port}/${inputDir}?password=${password}&fileName=$simple{header.CamelFileNameOnly}"/> > <route> > <from uri="file:src/data?noop=true"/> > <to uri="ref:ftpIn"/> > <delay> > <constant>10000</constant> > </delay> > </route> > </camel:camelContext> > > It's working fine. > > But now I'm facing another challenge I hadn't when using Camel's consumer > template : I need to fetch the transformed file from FTP again, but in > another directory. Clearly I need to pass the filename in the URI. But then > the component needs to be in the same route as in this INCORRECT example : > > <endpoint id="ftpSender" > uri="ftp://${user}@${hostname}:${port}/${inputDir}?password=${password}&fileName=$simple{header.CamelFileNameOnly}"/> > > <endpoint id="ftpReceiver" > uri="ftp://${user}@${hostname}:${port}/${inputDir}?password=${password}&deleteAfter=false&fileName=$simple{header.CamelFileNameOnly}"/> > > <route> > <from uri="file:src/data?noop=true"/> > <to uri="ref:ftpSender"/> > <delay> > <constant>10000</constant> > </delay> > <from uri="ref:ftpReceiver"/> > <log message="End route"/> > </route> > > > In my first attempt, with ConsumerTemplate, it was easy, I simply used the > beans() element of the route and did my job by calling ConsumerTemplate. > > But how do I do it without beans() ? > I could use another route but then how would I pass the file name to this new > route ? > > I must admit, as you can see, that I'm completely confused. > > I hope it is clearer. > > Regards. > -- > Bruno Dusausoy > Software Engineer > YP5 Software > -- > Pensez environnement : limitez l'impression de ce mail. > Please don't print this e-mail unless you really need to.