camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Load balancing in Camel
Date Tue, 03 Mar 2009 08:01:54 GMT
On Tue, Mar 3, 2009 at 8:55 AM, Nivetha Shri <nivishri@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/

Mime
View raw message