You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Christos Vasilakis <cv...@gmail.com> on 2012/02/08 18:33:38 UTC

Choich() with multiple Routing EIP

Hi there,

first of all many thanks for your excellent work!. It really makes my life easier!

I am newcomer to camel so please bear with me ;)

I have the following route:

		from("switchyard://ServiceRRDRoute").routeId("ServiceRRDRoute")
		.wireTap("jms:svc_rrd_audit?connectionFactory=#JmsXA")
		.choice()
			.when(header("ServiceRRD_msg_type").isEqualTo("fetchGraphSimple"))
				.unmarshal().json(JsonLibrary.Jackson, FetchGraphSimpleCommandMessage.class)
				.dynamicRouter(bean("bean:RecipientListBean?method=processSimpleGraph"))
				.log("fetchGraphSimple request send to consumers.")
				.end()
			.when(header("ServiceRRD_msg_type").isEqualTo("fetchLast"))
				.unmarshal().json(JsonLibrary.Jackson, FetchLastCommandMessage.class)
				.to("bean:RecipientListBean?method=processFetchLast")
				.recipientList(header("ServiceRRD_recipients"))
				.log("fetchLast request send to consumers.")

But I get a compile error
	cannot find symbol method when(org.apache.camel.Predicate)

Basically the second when() fails to compile?

This means that in the choice() I can't use dynamicRouter() and recipientList() together? Or is there any other way to accomplish this

Thanks for all your help

Regards,
Christos




Re: Choich() with multiple Routing EIP

Posted by Christos Vasilakis <cv...@gmail.com>.
Hi there,
> 
> Hadrian
> I replied to you on irc yesterday, but it looks like you didn't get it. It's a camel bug [1]
Yes it was late at night and decided to leave work... ;) Nice to hear that will be fixed. Thanks!


> Claus
> There is a a .endChoice() which may do the trick.

yeap endChoice() did the trick works fine now! ;)

I found a relative page that describes the error I am facing
http://camel.apache.org/why-can-i-not-use-when-or-otherwise-in-a-java-camel-route.html

Regards
Christos

On 9 Φεβ 2012, at 3:10 μ.μ., Hadrian Zbarcea wrote:

> Christos,
> 
> I replied to you on irc yesterday, but it looks like you didn't get it. It's a camel bug [1]. I have a fix I will commit today which will require you to use end() and it will work (right now it doesn't). See the explanation in CAMEL-4995 [1].
> 
> Hadrian
> 
> 
> [1] https://issues.apache.org/jira/browse/CAMEL-4995
> 
> 
> On 02/08/2012 12:33 PM, Christos Vasilakis wrote:
>> Hi there,
>> 
>> first of all many thanks for your excellent work!. It really makes my life easier!
>> 
>> I am newcomer to camel so please bear with me ;)
>> 
>> I have the following route:
>> 
>> 		from("switchyard://ServiceRRDRoute").routeId("ServiceRRDRoute")
>> 		.wireTap("jms:svc_rrd_audit?connectionFactory=#JmsXA")
>> 		.choice()
>> 			.when(header("ServiceRRD_msg_type").isEqualTo("fetchGraphSimple"))
>> 				.unmarshal().json(JsonLibrary.Jackson, FetchGraphSimpleCommandMessage.class)
>> 				.dynamicRouter(bean("bean:RecipientListBean?method=processSimpleGraph"))
>> 				.log("fetchGraphSimple request send to consumers.")
>> 				.end()
>> 			.when(header("ServiceRRD_msg_type").isEqualTo("fetchLast"))
>> 				.unmarshal().json(JsonLibrary.Jackson, FetchLastCommandMessage.class)
>> 				.to("bean:RecipientListBean?method=processFetchLast")
>> 				.recipientList(header("ServiceRRD_recipients"))
>> 				.log("fetchLast request send to consumers.")
>> 
>> But I get a compile error
>> 	cannot find symbol method when(org.apache.camel.Predicate)
>> 
>> Basically the second when() fails to compile?
>> 
>> This means that in the choice() I can't use dynamicRouter() and recipientList() together? Or is there any other way to accomplish this
>> 
>> Thanks for all your help
>> 
>> Regards,
>> Christos
>> 
>> 
>> 
>> 
> 
> -- 
> Hadrian Zbarcea
> Principal Software Architect
> Talend, Inc
> http://coders.talend.com/
> http://camelbot.blogspot.com/


Re: Choich() with multiple Routing EIP

Posted by Hadrian Zbarcea <hz...@gmail.com>.
Christos,

I replied to you on irc yesterday, but it looks like you didn't get it. 
It's a camel bug [1]. I have a fix I will commit today which will 
require you to use end() and it will work (right now it doesn't). See 
the explanation in CAMEL-4995 [1].

Hadrian


[1] https://issues.apache.org/jira/browse/CAMEL-4995


On 02/08/2012 12:33 PM, Christos Vasilakis wrote:
> Hi there,
>
> first of all many thanks for your excellent work!. It really makes my life easier!
>
> I am newcomer to camel so please bear with me ;)
>
> I have the following route:
>
> 		from("switchyard://ServiceRRDRoute").routeId("ServiceRRDRoute")
> 		.wireTap("jms:svc_rrd_audit?connectionFactory=#JmsXA")
> 		.choice()
> 			.when(header("ServiceRRD_msg_type").isEqualTo("fetchGraphSimple"))
> 				.unmarshal().json(JsonLibrary.Jackson, FetchGraphSimpleCommandMessage.class)
> 				.dynamicRouter(bean("bean:RecipientListBean?method=processSimpleGraph"))
> 				.log("fetchGraphSimple request send to consumers.")
> 				.end()
> 			.when(header("ServiceRRD_msg_type").isEqualTo("fetchLast"))
> 				.unmarshal().json(JsonLibrary.Jackson, FetchLastCommandMessage.class)
> 				.to("bean:RecipientListBean?method=processFetchLast")
> 				.recipientList(header("ServiceRRD_recipients"))
> 				.log("fetchLast request send to consumers.")
>
> But I get a compile error
> 	cannot find symbol method when(org.apache.camel.Predicate)
>
> Basically the second when() fails to compile?
>
> This means that in the choice() I can't use dynamicRouter() and recipientList() together? Or is there any other way to accomplish this
>
> Thanks for all your help
>
> Regards,
> Christos
>
>
>
>

-- 
Hadrian Zbarcea
Principal Software Architect
Talend, Inc
http://coders.talend.com/
http://camelbot.blogspot.com/

Re: Choich() with multiple Routing EIP

Posted by Claus Ibsen <cl...@gmail.com>.
There is a a .endChoice() which may do the trick.


On Wed, Feb 8, 2012 at 6:33 PM, Christos Vasilakis <cv...@gmail.com> wrote:
> Hi there,
>
> first of all many thanks for your excellent work!. It really makes my life easier!
>
> I am newcomer to camel so please bear with me ;)
>
> I have the following route:
>
>                from("switchyard://ServiceRRDRoute").routeId("ServiceRRDRoute")
>                .wireTap("jms:svc_rrd_audit?connectionFactory=#JmsXA")
>                .choice()
>                        .when(header("ServiceRRD_msg_type").isEqualTo("fetchGraphSimple"))
>                                .unmarshal().json(JsonLibrary.Jackson, FetchGraphSimpleCommandMessage.class)
>                                .dynamicRouter(bean("bean:RecipientListBean?method=processSimpleGraph"))
>                                .log("fetchGraphSimple request send to consumers.")
>                                .end()
>                        .when(header("ServiceRRD_msg_type").isEqualTo("fetchLast"))
>                                .unmarshal().json(JsonLibrary.Jackson, FetchLastCommandMessage.class)
>                                .to("bean:RecipientListBean?method=processFetchLast")
>                                .recipientList(header("ServiceRRD_recipients"))
>                                .log("fetchLast request send to consumers.")
>
> But I get a compile error
>        cannot find symbol method when(org.apache.camel.Predicate)
>
> Basically the second when() fails to compile?
>
> This means that in the choice() I can't use dynamicRouter() and recipientList() together? Or is there any other way to accomplish this
>
> Thanks for all your help
>
> Regards,
> Christos
>
>
>



-- 
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/

Re: Choich() with multiple Routing EIP

Posted by Willem Jiang <wi...@gmail.com>.
You can try to leverage the direct enpoint to break the big route into 
smaller ones.
Here is an example
from("xxx").choice()
    when(...).to("direct:simple").end().
    when(...).to("direct:last").end();

from("direct:simple").to("xxx");
from("direct:last").to("xxx");

On Thu Feb  9 01:33:38 2012, Christos Vasilakis wrote:
> Hi there,
>
> first of all many thanks for your excellent work!. It really makes my life easier!
>
> I am newcomer to camel so please bear with me ;)
>
> I have the following route:
>
> 		from("switchyard://ServiceRRDRoute").routeId("ServiceRRDRoute")
> 		.wireTap("jms:svc_rrd_audit?connectionFactory=#JmsXA")
> 		.choice()
> 			.when(header("ServiceRRD_msg_type").isEqualTo("fetchGraphSimple"))
> 				.unmarshal().json(JsonLibrary.Jackson, FetchGraphSimpleCommandMessage.class)
> 				.dynamicRouter(bean("bean:RecipientListBean?method=processSimpleGraph"))
> 				.log("fetchGraphSimple request send to consumers.")
> 				.end()
> 			.when(header("ServiceRRD_msg_type").isEqualTo("fetchLast"))
> 				.unmarshal().json(JsonLibrary.Jackson, FetchLastCommandMessage.class)
> 				.to("bean:RecipientListBean?method=processFetchLast")
> 				.recipientList(header("ServiceRRD_recipients"))
> 				.log("fetchLast request send to consumers.")
>
> But I get a compile error
> 	cannot find symbol method when(org.apache.camel.Predicate)
>
> Basically the second when() fails to compile?
>
> This means that in the choice() I can't use dynamicRouter() and recipientList() together? Or is there any other way to accomplish this
>
> Thanks for all your help
>
> Regards,
> Christos
>
>
>
>



-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
         http://jnn.javaeye.com (Chinese)
Twitter: willemjiang 
Weibo: willemjiang