Apache Camel - File Transfer on Particular Route Call
<p>I'm trying to create a webservice which, when called look into a local directory picks up files from there and upload to the ftp server.</p>

<p>I'm able to create a simple route which picks file from local directory and uploads to ftp server below is the code :</p>

<pre><code>&lt;route&gt;
        &lt;from uri="file://D:\\FTPTest?noop=true&amp;amp;delay=2000" /&gt;
        &lt;to uri="ftp://user@host.in:21/public_html/EnterpriseProject?password=password123#"/&gt;
        &lt;to uri="bean:myBean?method=test" /&gt;
    &lt;/route&gt;
</code></pre>

<p>But, I want to this file transfer to be called when a particular route is called via restlet webservice is called, I tried with the following code, but it didn't work :</p>

<pre><code>&lt;route&gt;
        &lt;from uri="direct:fileTransferRoute" /&gt;
            &lt;to uri="file://D:\\FTPTest?noop=true&amp;amp;delay=2000" /&gt;
            &lt;to uri="ftp://user@host.in:21/public_html/EnterpriseProject?password=password123#"/&gt;
        &lt;/route&gt;
</code></pre>

<p>The above route is called by restlet from following route :</p>

<pre><code>&lt;route&gt;
&lt;from
            uri="restlet:http://0.0.0.0:9080/csitec/{serviceName}?restletMethod=post" /&gt;
        &lt;process ref="serviceRouteProcessor" /&gt;
        &lt;toD uri="direct:${in.header.nextRoute}" /&gt;

    &lt;/route&gt;
</code></pre>

<p>Here's the code of my serviceRouteProcessor :</p>

<pre><code>public void process(Exchange exchange) throws Exception {
    String body = exchange.getIn().getBody(String.class);
    String serviceName = exchange.getIn().getHeader(Constants.SERVICE_NAME).toString();
    String nextRoute = serviceName+Constants.NEXT_ROUTE_APPENDER;
    exchange.getOut().setHeader(Constants.NEXT_ROUTE, nextRoute);
    exchange.getOut().setBody(body);
}
</code></pre>

<p>Please help me and suggest the changes needs to be done to make it work like this.</p>