You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by renamsavio <re...@gmail.com> on 2013/01/24 20:10:00 UTC

File component - run them sequentially

Hi there,
I have a doubt.. I've got 3 File components. But I wanna know how to make
them run sequentially..in other words, the second File component will be run
just when the first one finishes its work in all the files from that
directory, and so on.! I tried to use 'delay', but it's not always i will be
able to know the exact time the first component will finish. I searched a
lot about this but i couldn't find a answer..

Thanks!



--
View this message in context: http://camel.465427.n5.nabble.com/File-component-run-them-sequentially-tp5726185.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: File component - run them sequentially

Posted by renamsavio <re...@gmail.com>.
Ok, Thanks Claus..I'll try that!!



--
View this message in context: http://camel.465427.n5.nabble.com/File-component-run-them-sequentially-tp5726185p5726437.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: File component - run them sequentially

Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Jan 25, 2013 at 3:38 PM, renamsavio <re...@gmail.com> wrote:
> Does someone have any idea how to solve it?
>

You can use the API on CamelContext to start|stop routes. So you would
need to figure out
when there is no more files on route1, to start route2, and so forth.
And what should happen when route 3 is done. Should it start route1.
So it goes in round robin?

You can enable the sendEmptyMessageWhenIdle=true, which will have an
empty message being sent out in the route.
Then you can use that to know that there is no more file, and then
start the next route
http://camel.apache.org/how-can-i-stop-a-route-from-a-route.html

In Camel 2.11 it may be a bit easier with the control bus eip
http://camel.apache.org/controlbus.html

You can also use on completion
http://camel.apache.org/oncompletion.html

That may be easier. The file consumer is batch consumer, so there is a
special header that tells when the batch is done = no more files.
Then in the on consumer you can filter on that, and react upon
stopping current route, and start next.




> Thanks!
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/File-component-run-them-sequentially-tp5726185p5726264.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: File component - run them sequentially

Posted by renamsavio <re...@gmail.com>.
Does someone have any idea how to solve it?

Thanks!



--
View this message in context: http://camel.465427.n5.nabble.com/File-component-run-them-sequentially-tp5726185p5726264.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: File component - run them sequentially

Posted by renamsavio <re...@gmail.com>.
Each file component handles with a diferent directory..

directory "root" (File Component 1)
           directory 1 (File Component 2) - File Component 1 finishes
processing all the files from its directory, so it starts
           directory 2 (File Component 3) - File Component 2 finishes
processing all the files from its directory, so it starts

Whether I don't use the option 'delay'..the 3 file components starts
randomly. I tried to create a logic putting them inside a Direct
component(don't know whether it's a good practice), but they even start and
stop randomly and simultaneously.

Thanks!



--
View this message in context: http://camel.465427.n5.nabble.com/File-component-run-them-sequentially-tp5726185p5726200.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: File component - run them sequentially

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Jan 24, 2013 at 8:10 PM, renamsavio <re...@gmail.com> wrote:
> Hi there,
> I have a doubt.. I've got 3 File components. But I wanna know how to make
> them run sequentially..in other words, the second File component will be run
> just when the first one finishes its work in all the files from that
> directory, and so on.! I tried to use 'delay', but it's not always i will be
> able to know the exact time the first component will finish. I searched a
> lot about this but i couldn't find a answer..
>

Why do you have 3 file components, why not have only 1?


> Thanks!
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/File-component-run-them-sequentially-tp5726185.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen