You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by kalber <Ka...@swslt.com> on 2013/09/17 14:25:04 UTC

Route with more uris e.g. .to(uri1, uri2 .. ), uris are processed sequential?

I setup route below  where in to method i call first the direct:delete and
after direct:insert.
direct:delete cleans  and direct:insert populates a table.

My question is, direct:insert starts after direct:delete has finish ?
Are the to uris processed sequential ? 

// route
from(String.format(
"sql:%s?dataSource=#dataSource.busmsg&consumer.useIterator=false",
						composeSql())).to("direct:delete", "direct:insert")
				.process(new StopCamel());

// delete
from("direct:delete")	.to("sql:delete cust_st_bus_empty where
table_suffix='{{table.busmsg.suffix}}'?dataSource=#dataSource.infor");

// insert
from("direct:insert")
.transform().method(BusEmptyTransform.class).to("sql:insert into
cust_st_bus_empty(id,dt_crt,obj_code,obj_org,dt_trasf_start,dt_trasf_end,per_code,trasf_ours,trasf_min,
table_suffix) values
(sys_guid(),sysdate,#,#,#,#,#,#,#,#)?dataSource=#dataSource.infor&batch=true");




-----
kh
--
View this message in context: http://camel.465427.n5.nabble.com/Route-with-more-uris-e-g-to-uri1-uri2-uris-are-processed-sequential-tp5739651.html
Sent from the Camel - Users mailing list archive at Nabble.com.

AW: Route with more uris e.g. .to(uri1, uri2 .. ), uris are processed sequential?

Posted by "Jan Matèrne (jhm)" <ap...@materne.de>.
AFAIK all _routes_ are started directly - meaning, that they are available
for incoming exchanges.

If an exchange come in, the desired route consumes that exchange and routes
through a pipeline of processors until it ends or sends to another route
(another pipeline of processors).


I cut some string operations from your code for easier understanding:
// route
from("sql:...")
  .to("direct:delete", "direct:insert")
  .process(new StopCamel());

// delete
from("direct:delete")	
  .to("sql:delete...");

// insert
from("direct:insert")
  .transform().method(BusEmptyTransform.class)
  .to("sql:insert...");

Here your starting route "route" forward to direct:delete and direct:insert
in a single to() call. Here I dont know how Camel does the processing. (Is
this a splitter? Is it a short text for to(1).to(2)?)


BTW you could use fromF() instead of from().
http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/bu
ilder/RouteBuilder.html#fromF%28java.lang.String,%20java.lang.Object...%29


Jan


> -----Ursprüngliche Nachricht-----
> Von: kalber [mailto:Karlheinz.Alber@swslt.com]
> Gesendet: Dienstag, 17. September 2013 14:25
> An: users@camel.apache.org
> Betreff: Route with more uris e.g. .to(uri1, uri2 .. ), uris are
> processed sequential?
> 
> I setup route below  where in to method i call first the direct:delete
> and after direct:insert.
> direct:delete cleans  and direct:insert populates a table.
> 
> My question is, direct:insert starts after direct:delete has finish ?
> Are the to uris processed sequential ?
> 
> // route
> from(String.format(
> "sql:%s?dataSource=#dataSource.busmsg&consumer.useIterator=false",
>
composeSql())).to("direct:delete",
> "direct:insert")
> 				.process(new StopCamel());
> 
> // delete
> from("direct:delete")	.to("sql:delete cust_st_bus_empty where
> table_suffix='{{table.busmsg.suffix}}'?dataSource=#dataSource.infor");
> 
> // insert
> from("direct:insert")
> .transform().method(BusEmptyTransform.class).to("sql:insert into
> cust_st_bus_empty(id,dt_crt,obj_code,obj_org,dt_trasf_start,dt_trasf_en
> d,per_code,trasf_ours,trasf_min,
> table_suffix) values
> (sys_guid(),sysdate,#,#,#,#,#,#,#,#)?dataSource=#dataSource.infor&batch
> =true");
> 
> 
> 
> 
> -----
> kh
> --
> View this message in context: http://camel.465427.n5.nabble.com/Route-
> with-more-uris-e-g-to-uri1-uri2-uris-are-processed-sequential-
> tp5739651.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


AW: Route with more uris e.g. .to(uri1, uri2 .. ), uris are processed sequential?

Posted by "Jan Matèrne (jhm)" <ap...@materne.de>.
I would avoid having multiple uris in that case and rewrite that:

fromF("sql:...")
  .to("direct:delete")
  .to("direct:insert")
  .process(new StopCamel());


Jan


> -----Ursprüngliche Nachricht-----
> Von: kalber [mailto:Karlheinz.Alber@swslt.com]
> Gesendet: Dienstag, 17. September 2013 15:50
> An: users@camel.apache.org
> Betreff: Re: Route with more uris e.g. .to(uri1, uri2 .. ), uris are
> processed sequential?
> 
> I substitute from with fromF, thanks.
> 
> This route works, but i'm not sure if delete finish before insert
> starts ?
> 
> So the question is are this uris processed sequential ?
> 
> 
> 
> -----
> kh
> --
> View this message in context: http://camel.465427.n5.nabble.com/Route-
> with-more-uris-e-g-to-uri1-uri2-uris-are-processed-sequential-
> tp5739651p5739669.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Route with more uris e.g. .to(uri1, uri2 .. ), uris are processed sequential?

Posted by kalber <Ka...@swslt.com>.
I substitute from with fromF, thanks.

This route works, but i'm not sure if delete finish before insert starts ?

So the question is are this uris processed sequential ?



-----
kh
--
View this message in context: http://camel.465427.n5.nabble.com/Route-with-more-uris-e-g-to-uri1-uri2-uris-are-processed-sequential-tp5739651p5739669.html
Sent from the Camel - Users mailing list archive at Nabble.com.