You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Gert Villemos <gv...@yahoo.de> on 2011/08/25 15:21:50 UTC

Starting a route after another completes

I have a route 'from' a file component processing all files in a directory.

When all have been processed (and not before), then I want another route to
start.

I tried 'startupOrder' but both routes are still started almost together,
not when the lower order has completed.

How can I configure that a route starts only when another route has
completed?


--
View this message in context: http://camel.465427.n5.nabble.com/Starting-a-route-after-another-completes-tp4734464p4734464.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Starting a route after another completes

Posted by mister blinky <mi...@gmail.com>.
thanks. Although i've been over and over the onCompletion and Batch Consumer
doc pages, your prompting at least made me realize i was looking in the
right place! 

So for others who may have this issue, here's the solution. Basically you
test in onCompletion for when the batch is complete. Nice and simple.

			from("file://mydir?noop=true")
			.onCompletion().onWhen(simple("${header.CamelBatchComplete} == true"))
				.log("In onCompletion!")
				.to("direct:onwardAndUpward")
			.end()
			.to("ftp://user@host//dir?password=pwd")
			.end();

			from("direct:onwardAndUpward").log("ONWARD!!!!").end();

thank you Claus



--
View this message in context: http://camel.465427.n5.nabble.com/Starting-a-route-after-another-completes-tp4734464p5746604.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Starting a route after another completes

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

This has been discussed before on these forums.

Look for on completion onWhen the batch is complete.
http://camel.apache.org/oncompletion.html
http://camel.apache.org/batch-consumer.html

On Wed, Jan 29, 2014 at 4:03 PM, mister blinky <mi...@gmail.com> wrote:
> I would like to bump this question. It seems like a common scenario that
> should be handled in a simpler (to the developer) way. Here's my scenario:
>
> 1) FTP the contents of a directory to a remote server
> 2) When the FTP is complete, do something with the files ...
>
> So this is the route for (1)
> from("file://C:/mydir?noop=true")
> .to("ftp://user@host//remotedir?password=password");
>
> If i put a .to("direct:xxx") or .to("vm:xxx") then xxx is basically invoked
> after EACH file is ftp-ed. I need a way to invoke a flow ONLY after the
> entire directory has been FTP-ed.
>
> I'm sure there's a simple way to ensure that (1) is complete before invoking
> (2) ... no?
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Starting-a-route-after-another-completes-tp4734464p5746601.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Make your Camel applications look hawt, try: http://hawt.io

Re: Starting a route after another completes

Posted by mister blinky <mi...@gmail.com>.
I would like to bump this question. It seems like a common scenario that
should be handled in a simpler (to the developer) way. Here's my scenario:

1) FTP the contents of a directory to a remote server
2) When the FTP is complete, do something with the files ...

So this is the route for (1)
from("file://C:/mydir?noop=true")
.to("ftp://user@host//remotedir?password=password");

If i put a .to("direct:xxx") or .to("vm:xxx") then xxx is basically invoked
after EACH file is ftp-ed. I need a way to invoke a flow ONLY after the
entire directory has been FTP-ed.

I'm sure there's a simple way to ensure that (1) is complete before invoking
(2) ... no?



--
View this message in context: http://camel.465427.n5.nabble.com/Starting-a-route-after-another-completes-tp4734464p5746601.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Starting a route after another completes

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Aug 25, 2011 at 3:21 PM, Gert Villemos <gv...@yahoo.de> wrote:
> I have a route 'from' a file component processing all files in a directory.
>
> When all have been processed (and not before), then I want another route to
> start.
>
> I tried 'startupOrder' but both routes are still started almost together,
> not when the lower order has completed.
>
> How can I configure that a route starts only when another route has
> completed?
>

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

Can be used to start another route as well.


>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Starting-a-route-after-another-completes-tp4734464p4734464.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



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