You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Nivetha Shri <ni...@gmail.com> on 2009/03/03 08:55:29 UTC

Load balancing in Camel

Hi All
I want to know how we can combine dynamic routing and load balancing.

For dynamic routing am using @RecipientList annotation as follows

public class RoutingComponent{
    @RecipientList
    public String[] route(String Body) {
  String output = "activemq1:topic:topic.outbound";
return new String[] {output};
    }
}

And my RouterBuilder configuration is as follows:

from("activemq1:topic:topic.inbound").bean(RoutingComponent.class, "route");

In general it is given that load balancing can be achieved as

from("activemq1:topic:topic.inbound").loadBalance().roundRobin("outputqueue1","outputqueue2");

But how can we achieve it using @RecipientList?

Any insight on this will be really helpful

Thanks and Regards
Nivi

Re: Load balancing in Camel

Posted by nikagra <ni...@gmail.com>.
Hi
Is there any updates on how to use load balancer with dynamic router.
Thanks in advance



--
View this message in context: http://camel.465427.n5.nabble.com/Load-balancing-in-Camel-tp473773p5732402.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Load balancing in Camel

Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Mar 3, 2009 at 8:55 AM, Nivetha Shri <ni...@gmail.com> wrote:
> Hi All
> I want to know how we can combine dynamic routing and load balancing.
>
> For dynamic routing am using @RecipientList annotation as follows
>
> public class RoutingComponent{
>    @RecipientList
>    public String[] route(String Body) {
>  String output = "activemq1:topic:topic.outbound";
> return new String[] {output};
>    }
> }
>
> And my RouterBuilder configuration is as follows:
>
> from("activemq1:topic:topic.inbound").bean(RoutingComponent.class, "route");
>
> In general it is given that load balancing can be achieved as
>
> from("activemq1:topic:topic.inbound").loadBalance().roundRobin("outputqueue1","outputqueue2");
>
> But how can we achieve it using @RecipientList?
>
> Any insight on this will be really helpful
Well using @RecipientList aka Dynamic Recipient EIP pattern, then its
YOU that are responsible for providing the endpoint(s) that should
receive the same message.

So you can implement your own round robin implementation in the code
and return a different endpoint on each invocation.

I need to think a bit more if/how you can use @RecipientList with
Camels load balancer directly. But its an interesting use case to be
able to support.




>
> Thanks and Regards
> Nivi
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/