You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Jonas Lanzendörfer <ge...@gmx.de> on 2012/09/14 16:08:06 UTC

Camel sftp

Hi there,

I am very new to Camel and try to solve the following problem.

I have files on Server A and want to copy them to Server B and then read the content and save the content to a database. I want to process every file only once…

I started to set up a camel route like this:

 from("sftp://serverA:/../." + "" +
                        "./dir/?privateKeyFile=/someFile/" +
                        ".ssh/rsa&stepwise=false&filter=#notTodayFilter").to("file:data/outbox");

The filter only filters some files. 

My problem is, when the sftp consumer has consumed every file once it starts again and again, as long as the camel context is running.

How can I tell him to stop after the first round?

When I start the context…lets say….on the next day, how can I tell camel not to process the same files again but to only copy new files? 


Thanx a lot!

Re: Camel sftp

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

See this FAQ
http://camel.apache.org/how-can-i-stop-a-route-from-a-route.html

Or you can use a route policy and then schedule the routes to
start|stop after timing. Or when then last file has been transferred.
http://camel.apache.org/routepolicy

And take a look at the idempotent consumer EIP for skipping already
processed files. The ftp component has that built-in.
http://camel.apache.org/idempotent-consumer.html


On Fri, Sep 14, 2012 at 4:08 PM, Jonas Lanzendörfer <ge...@gmx.de> wrote:
> Hi there,
>
> I am very new to Camel and try to solve the following problem.
>
> I have files on Server A and want to copy them to Server B and then read the content and save the content to a database. I want to process every file only once…
>
> I started to set up a camel route like this:
>
>  from("sftp://serverA:/../." + "" +
>                         "./dir/?privateKeyFile=/someFile/" +
>                         ".ssh/rsa&stepwise=false&filter=#notTodayFilter").to("file:data/outbox");
>
> The filter only filters some files.
>
> My problem is, when the sftp consumer has consumed every file once it starts again and again, as long as the camel context is running.
>
> How can I tell him to stop after the first round?
>
> When I start the context…lets say….on the next day, how can I tell camel not to process the same files again but to only copy new files?
>
>
> Thanx a lot!



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen