camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dsemenov <>
Subject Single instance streaming from sftp
Date Fri, 17 May 2013 15:29:02 GMT
Hello community.

I have to implement a solution, where two jvm instances run the same camel
route, but only one (leader) has to complete it.

The route should be executed by scheduler (timer).

The route execution (in case that jvm instance is leader) should retrieve
file via sftp, and process each line, and then send it to other endpoint
(sftp as well).
The file could be very big, so streaming should be applied to avid memory
consumption. New line separator should be used as a tokenizer.

We implemented some route to acquire leadership, which sets the Body = true
in case of success.

so we implement our single instance executions like:

<from uri="timer://timer.... />
 <to uri="dirrect:acquireLeadership" />
   <log message="instance is leader, processing" />
   <to uri="direct:process" />
   <log message="failed to acquire leadership" />

My question is how can i organize direct:process sub-route to consume and
stream sftp files.

I was looking on <stream/> and <enrich/> endpoints, but i cannot figure out
how can i organize processing sub-routes, because i need another consumer
for <stream/> like

<camel:from uri="stream:file?fileName=/path/to/file/downloaded/from/sftp"/>

Maybe i can organize cross-process locking using sftp consumer itself, i.e
lock files, but i think it's impossible, because each instance has it's own

Additional info.
- We use camel 2.8.0
- We cannot use zookeeper and other tools for cross-process synchronization 

View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message