You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "prabumca06@gmail.com" <pr...@gmail.com> on 2013/04/15 16:43:37 UTC

Camel routing DSL - Questions

Question:1

I am having code like blow.based on condition i want forward into dynamic
queue.

 .when(header(TYPE).isNotNull())
  .recipientList(simple("activemq:queue:Inbound.${header.TYPE}"))

i want to use .to(simple ) insight of .recipientList(simple)

Please suggest is it possible?.why it is not possible is there any
performance issue if i use .recipientList(simple)

Question:2

Error in code

from(INBOUND_QUEUE)
.choice().when(header(TYPE).isNotNull())
  .recipientList(simple("activemq:queue:Inbound.${header.TYPE}"))
.otherwise()
   .to(ERQ_QNAME)
.endChoice();

After execute i am getting following error.

Error:

Router.java:22: cannot find symbol
symbol  : method otherwise()
location: class
org.apache.camel.model.RecipientListDefinition<org.apache.camel.
model.ChoiceDefinition>
           .otherwise()
           ^

Question:3

I having more than 85 queues.Based on condition i want to forward to correct
queue.

In my route builder i having code below for all 85 queus.

  from(ALERT_QNAME).choice()
          .when(ALERT_PREDICATE).to(ALERT_QNAME)        
          .otherwise()
          .to(ERQ_QNAME)
 .end();

I feel like because of my code performance getting degrade.Please suggest if
i am wrong?
 
When i open jconsole i am getting white screen and queues some time not
showing any attribute?

Please kindly help me. 



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-routing-DSL-Questions-tp5730917.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel routing DSL - Questions

Posted by Marco Westermann <Ma...@gmx.de>.
I guess you would get more help if you are more patient and not sent 
three mails in 10 minutes asking the same.

Marco


Am 15.04.2013 16:43, schrieb prabumca06@gmail.com:
> Question:1
>
> I am having code like blow.based on condition i want forward into dynamic
> queue.
>
>   .when(header(TYPE).isNotNull())
>    .recipientList(simple("activemq:queue:Inbound.${header.TYPE}"))
>
> i want to use .to(simple ) insight of .recipientList(simple)
>
> Please suggest is it possible?.why it is not possible is there any
> performance issue if i use .recipientList(simple)
>
> Question:2
>
> Error in code
>
> from(INBOUND_QUEUE)
> .choice().when(header(TYPE).isNotNull())
>    .recipientList(simple("activemq:queue:Inbound.${header.TYPE}"))
> .otherwise()
>     .to(ERQ_QNAME)
> .endChoice();
>
> After execute i am getting following error.
>
> Error:
>
> Router.java:22: cannot find symbol
> symbol  : method otherwise()
> location: class
> org.apache.camel.model.RecipientListDefinition<org.apache.camel.
> model.ChoiceDefinition>
>             .otherwise()
>             ^
>
> Question:3
>
> I having more than 85 queues.Based on condition i want to forward to correct
> queue.
>
> In my route builder i having code below for all 85 queus.
>
>    from(ALERT_QNAME).choice()
>            .when(ALERT_PREDICATE).to(ALERT_QNAME)
>            .otherwise()
>            .to(ERQ_QNAME)
>   .end();
>
> I feel like because of my code performance getting degrade.Please suggest if
> i am wrong?
>   
> When i open jconsole i am getting white screen and queues some time not
> showing any attribute?
>
> Please kindly help me.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-routing-DSL-Questions-tp5730917.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


Re: Camel routing DSL - Questions

Posted by "prabumca06@gmail.com" <pr...@gmail.com>.
Thanks for reply

one more question pending

Question:2

Error in code

from(INBOUND_QUEUE)
.choice().when(header(TYPE).isNotNull())
  .recipientList(simple("activemq:queue:Inbound.${header.TYPE}"))
.otherwise()
   .to(ERQ_QNAME)
.endChoice();

After execute i am getting following error.

Error:

Router.java:22: cannot find symbol
symbol  : method otherwise()
location: class
org.apache.camel.model.RecipientListDefinition<org.apache.camel.
model.ChoiceDefinition>
           .otherwise()
           ^ 



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-routing-DSL-Questions-tp5730917p5730931.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel routing DSL - Questions

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

And for #3 you can use the dynamic router,
or recipient list, and call a method on a bean instead.  Then you
don't need 85 when's in the content based router, that is too much. eg
just as in regular java code, you do not want to have 85 x if .. else.

On Mon, Apr 15, 2013 at 4:43 PM, prabumca06@gmail.com
<pr...@gmail.com> wrote:
> Question:1
>
> I am having code like blow.based on condition i want forward into dynamic
> queue.
>
>  .when(header(TYPE).isNotNull())
>   .recipientList(simple("activemq:queue:Inbound.${header.TYPE}"))
>
> i want to use .to(simple ) insight of .recipientList(simple)
>
> Please suggest is it possible?.why it is not possible is there any
> performance issue if i use .recipientList(simple)
>
> Question:2
>
> Error in code
>
> from(INBOUND_QUEUE)
> .choice().when(header(TYPE).isNotNull())
>   .recipientList(simple("activemq:queue:Inbound.${header.TYPE}"))
> .otherwise()
>    .to(ERQ_QNAME)
> .endChoice();
>
> After execute i am getting following error.
>
> Error:
>
> Router.java:22: cannot find symbol
> symbol  : method otherwise()
> location: class
> org.apache.camel.model.RecipientListDefinition<org.apache.camel.
> model.ChoiceDefinition>
>            .otherwise()
>            ^
>
> Question:3
>
> I having more than 85 queues.Based on condition i want to forward to correct
> queue.
>
> In my route builder i having code below for all 85 queus.
>
>   from(ALERT_QNAME).choice()
>           .when(ALERT_PREDICATE).to(ALERT_QNAME)
>           .otherwise()
>           .to(ERQ_QNAME)
>  .end();
>
> I feel like because of my code performance getting degrade.Please suggest if
> i am wrong?
>
> When i open jconsole i am getting white screen and queues some time not
> showing any attribute?
>
> Please kindly help me.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-routing-DSL-Questions-tp5730917.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
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: Camel routing DSL - Questions

Posted by Claus Ibsen <cl...@gmail.com>.
For #2 see this FAQ
http://camel.apache.org/why-can-i-not-use-when-or-otherwise-in-a-java-camel-route.html



On Mon, Apr 15, 2013 at 4:43 PM, prabumca06@gmail.com
<pr...@gmail.com> wrote:
> Question:1
>
> I am having code like blow.based on condition i want forward into dynamic
> queue.
>
>  .when(header(TYPE).isNotNull())
>   .recipientList(simple("activemq:queue:Inbound.${header.TYPE}"))
>
> i want to use .to(simple ) insight of .recipientList(simple)
>
> Please suggest is it possible?.why it is not possible is there any
> performance issue if i use .recipientList(simple)
>
> Question:2
>
> Error in code
>
> from(INBOUND_QUEUE)
> .choice().when(header(TYPE).isNotNull())
>   .recipientList(simple("activemq:queue:Inbound.${header.TYPE}"))
> .otherwise()
>    .to(ERQ_QNAME)
> .endChoice();
>
> After execute i am getting following error.
>
> Error:
>
> Router.java:22: cannot find symbol
> symbol  : method otherwise()
> location: class
> org.apache.camel.model.RecipientListDefinition<org.apache.camel.
> model.ChoiceDefinition>
>            .otherwise()
>            ^
>
> Question:3
>
> I having more than 85 queues.Based on condition i want to forward to correct
> queue.
>
> In my route builder i having code below for all 85 queus.
>
>   from(ALERT_QNAME).choice()
>           .when(ALERT_PREDICATE).to(ALERT_QNAME)
>           .otherwise()
>           .to(ERQ_QNAME)
>  .end();
>
> I feel like because of my code performance getting degrade.Please suggest if
> i am wrong?
>
> When i open jconsole i am getting white screen and queues some time not
> showing any attribute?
>
> Please kindly help me.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-routing-DSL-Questions-tp5730917.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
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