You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by gudiseashok <gu...@gmail.com> on 2013/10/10 18:49:47 UTC

Can i use seda:start or direct:start to start a route?

Hi 

Sorry to be silly with my question but i would like to know whether
inter-communication components like seda/direct to kick start my routers, I
do have configured ActiveMQ also but I didn't find any justification myself
to kickstart only with MQ when I need to start some routers (load on
startup) and doesnt need any from any consumer.

So, suppose I have three routers A,B,C

I would like to know, whether is it a right approach to do like mentioned
below,

from("seda:start").multicast().parallelProcessing().to("direct:a","direct:b","direct:c");

from("direct:a").from("remoteFTP1:///")
						.routeId("ftpRoute1").to("file://{{sftp.destination.directory}}");
from("direct:b").from("remoteFTP2:///")
						.routeId("ftpRoute2").to("file://{{sftp.destination.directory}}");
from("direct:b").from("remoteFTP3:///")
						.routeId("ftpRoute3").to("file://{{sftp.destination.directory}}");

Because I read like "direct:XXX" is for synchronous communication but
multicast/parallel prosessing will be depricated in near future, 

but "seda:XXX" for asynchronous but we can configure this to act as
synchronous and can be used for operations like "fire and forget" with added
advantage of parallelprocessing with concurrentconsumer attribute.

I see lot of examples using from("seda:start,direct:start... and it is
working for me in my local, but most of the stuff being using either using
activeMQ or external end point.

Is it right way of doing to kick start (just to use loadOnstartup) using
"seda:start" or "direct:start" (I would like to use "seda:start",since its
been written it supports concurrent operation)

Regards
Ashok Gudise




--
View this message in context: http://camel.465427.n5.nabble.com/Can-i-use-seda-start-or-direct-start-to-start-a-route-tp5741305.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Can i use seda:start or direct:start to start a route?

Posted by gudiseashok <gu...@gmail.com>.
Hi Thanks for reply, I will change accordingly

adding to my previous question,

RouteBuilder routeBuilder = new RouteBuilder() {
	@Override
	public void configure() throws Exception {

		from("seda:start").routeId("mainRoute")
		.multicast().parallelProcessing().to("direct:a","direct:b");

		from("direct:a").from("sftp://ftp1)
			.routeId("helloRoute1").to("file://{{sftp.destination.directory}}");
		from("direct:b").from("sftp://ftp2)
			.routeId("helloRoute2").to("file://{{sftp.destination.directory}}");
	}
};

Thread.sleep(6000); //Wait for a minute

RouteBuilder routeBuilder1 = new RouteBuilder() {
	@Override
	public void configure() throws Exception {
		from("direct:c").from("sftp://ftp3")
		.routeId("helloRoute3").to("file://{{sftp.destination.directory}}");

	}
};
camelContext.addRoutes(routeBuilder1);
Thread.sleep(500000);

------------ Does this equal to 
<from uri="seda:start"/>
<multicast>
   <to uri="direct:a"/>
   <to uri="direct:a"/>
<multicast>

when I add <direct:c> like above 

<from uri="seda:start"/>
<multicast>
   <to uri="direct:a"/>
   <to uri="direct:a"/>
   <to uri="direct:c"/>
<multicast>  (does the above code converts like this?, because I want to add
another router which is similar to what I have added as parallel to those
already started processes).


Thanks you very much for your response.




--
View this message in context: http://camel.465427.n5.nabble.com/Can-i-use-seda-start-or-direct-start-to-start-a-route-tp5741305p5741311.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Can i use seda:start or direct:start to start a route?

Posted by Christian Posta <ch...@gmail.com>.
well, it's fine to kick off routes with direct or seda.
however what are you expecting your second route to do? poll the FTP
location? when you have from(a).from(b).to(...) you basically have two
separate entry points to your route: from(a) and from(b). so if you're
trying to kick of something to call FTP, change the from(remoteFTP) to use
pollEnrich().

HTH


On Thu, Oct 10, 2013 at 9:49 AM, gudiseashok <gu...@gmail.com> wrote:

> Hi
>
> Sorry to be silly with my question but i would like to know whether
> inter-communication components like seda/direct to kick start my routers, I
> do have configured ActiveMQ also but I didn't find any justification myself
> to kickstart only with MQ when I need to start some routers (load on
> startup) and doesnt need any from any consumer.
>
> So, suppose I have three routers A,B,C
>
> I would like to know, whether is it a right approach to do like mentioned
> below,
>
>
> from("seda:start").multicast().parallelProcessing().to("direct:a","direct:b","direct:c");
>
> from("direct:a").from("remoteFTP1:///")
>
> .routeId("ftpRoute1").to("file://{{sftp.destination.directory}}");
> from("direct:b").from("remoteFTP2:///")
>
> .routeId("ftpRoute2").to("file://{{sftp.destination.directory}}");
> from("direct:b").from("remoteFTP3:///")
>
> .routeId("ftpRoute3").to("file://{{sftp.destination.directory}}");
>
> Because I read like "direct:XXX" is for synchronous communication but
> multicast/parallel prosessing will be depricated in near future,
>
> but "seda:XXX" for asynchronous but we can configure this to act as
> synchronous and can be used for operations like "fire and forget" with
> added
> advantage of parallelprocessing with concurrentconsumer attribute.
>
> I see lot of examples using from("seda:start,direct:start... and it is
> working for me in my local, but most of the stuff being using either using
> activeMQ or external end point.
>
> Is it right way of doing to kick start (just to use loadOnstartup) using
> "seda:start" or "direct:start" (I would like to use "seda:start",since its
> been written it supports concurrent operation)
>
> Regards
> Ashok Gudise
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Can-i-use-seda-start-or-direct-start-to-start-a-route-tp5741305.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
*Christian Posta*
http://www.christianposta.com/blog
twitter: @christianposta