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}&amp;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}&amp;fileName=$simple{header.CamelFileNameOnly}"/>

        <endpoint id="ftpReceiver"

uri="ftp://${user}@${hostname}:${port}/${inputDir}?password=${password}&amp;deleteAfter=false&amp;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.

Reply via email to