You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Hilde <hi...@yahoo.de> on 2013/06/03 16:05:13 UTC
How to build a nested content based router?
Hello Everybody,
How can I model a nested content based router via the java dsl?
The following trial was not successful:
.choice()
.when(header(CxfConstants.OPERATION_NAME).isEqualTo("importOrder"))
.beanRef("logOrderConverter")
.to("jpa:com.company.production.entities.OrderMerging")
.choice()
.when(method(routeCheck, "checkSnapshot")) //content based router
.to("activemq:queue:" + JmsDestinations.QUEUE_ORDER_INPUT +
"?disableReplyTo=true")
.to("direct:endRoute")
.otherwise()
.process(new OrderConverter())
.to("activemq:queue:" + JmsDestinations.QUEUE_DI_JOB +
"?disableReplyTo=true")
.to("direct:endRoute")
.endChoice()
.when(header(CxfConstants.OPERATION_NAME).isEqualTo("deleteBrandData"))
.beanRef("convertWSBeanToOrderMergingEntityBean")
.to("jpa:com.copany.production.entities.OrderMerging")
.process(new OutMessageProcessor())
.endChoice();
Actually I don't know the differences between end() vs. endChoice().
Do you have any idea?
Thanks in advanced!
Cheers
Hilde
--
View this message in context: http://camel.465427.n5.nabble.com/How-to-build-a-nested-content-based-router-tp5733708.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to build a nested content based router?
Posted by Hilderich <hi...@yahoo.de>.
Thank you very much! I see!
--
View this message in context: http://camel.465427.n5.nabble.com/How-to-build-a-nested-content-based-router-tp5733708p5733799.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to build a nested content based router?
Posted by Claus Ibsen <cl...@gmail.com>.
You can use another route for the 2nd choice, and call that route
using direct. That is easier and you make the routes smaller and
easier to manage / test / understand etc.
Just like java code with many if .. else nested is not a good idea.
On Mon, Jun 3, 2013 at 4:05 PM, Hilde <hi...@yahoo.de> wrote:
> Hello Everybody,
>
> How can I model a nested content based router via the java dsl?
> The following trial was not successful:
>
> .choice()
> .when(header(CxfConstants.OPERATION_NAME).isEqualTo("importOrder"))
> .beanRef("logOrderConverter")
> .to("jpa:com.company.production.entities.OrderMerging")
> .choice()
> .when(method(routeCheck, "checkSnapshot")) //content based router
> .to("activemq:queue:" + JmsDestinations.QUEUE_ORDER_INPUT +
> "?disableReplyTo=true")
> .to("direct:endRoute")
> .otherwise()
> .process(new OrderConverter())
> .to("activemq:queue:" + JmsDestinations.QUEUE_DI_JOB +
> "?disableReplyTo=true")
> .to("direct:endRoute")
> .endChoice()
> .when(header(CxfConstants.OPERATION_NAME).isEqualTo("deleteBrandData"))
> .beanRef("convertWSBeanToOrderMergingEntityBean")
> .to("jpa:com.copany.production.entities.OrderMerging")
> .process(new OutMessageProcessor())
> .endChoice();
>
> Actually I don't know the differences between end() vs. endChoice().
>
> Do you have any idea?
>
> Thanks in advanced!
>
> Cheers
> Hilde
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-to-build-a-nested-content-based-router-tp5733708.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
www.camelone.org: The open source integration conference.
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: How to build a nested content based router?
Posted by Claus Ibsen <cl...@gmail.com>.
See this FAQ about the endChoice
https://camel.apache.org/why-can-i-not-use-when-or-otherwise-in-a-java-camel-route.html
On Mon, Jun 3, 2013 at 4:05 PM, Hilde <hi...@yahoo.de> wrote:
> Hello Everybody,
>
> How can I model a nested content based router via the java dsl?
> The following trial was not successful:
>
> .choice()
> .when(header(CxfConstants.OPERATION_NAME).isEqualTo("importOrder"))
> .beanRef("logOrderConverter")
> .to("jpa:com.company.production.entities.OrderMerging")
> .choice()
> .when(method(routeCheck, "checkSnapshot")) //content based router
> .to("activemq:queue:" + JmsDestinations.QUEUE_ORDER_INPUT +
> "?disableReplyTo=true")
> .to("direct:endRoute")
> .otherwise()
> .process(new OrderConverter())
> .to("activemq:queue:" + JmsDestinations.QUEUE_DI_JOB +
> "?disableReplyTo=true")
> .to("direct:endRoute")
> .endChoice()
> .when(header(CxfConstants.OPERATION_NAME).isEqualTo("deleteBrandData"))
> .beanRef("convertWSBeanToOrderMergingEntityBean")
> .to("jpa:com.copany.production.entities.OrderMerging")
> .process(new OutMessageProcessor())
> .endChoice();
>
> Actually I don't know the differences between end() vs. endChoice().
>
> Do you have any idea?
>
> Thanks in advanced!
>
> Cheers
> Hilde
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-to-build-a-nested-content-based-router-tp5733708.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
www.camelone.org: The open source integration conference.
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