You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Cappa Roberto <ro...@guest.telecomitalia.it> on 2010/07/21 13:06:36 UTC

LoadBalancing to a dynamic list of endpoints

Hi,

I need to loadBalance with failover to a list of final endpoints that can be dynamically calculated, so I cannot use ".to()" after the failover clause
I've tryed in this way, using the recipient list:

from("jetty:....")
                .process(new Processor() {
                    public void process(Exchange exc) throws Exception {
                        exc.getIn().setHeader("urls", 
                                "http://url1,http://url2");
                    }
                })
                .loadBalance()
                .failover(-1, true, true)
                .recipientList(header("urls").tokenize(","));

But it doesn't work, because the recipient list is not used in round-robin way.

Any idea?

Thanks.

Re: LoadBalancing to a dynamic list of endpoints

Posted by deeps26 <ga...@gmail.com>.
Hey do you have an example of a bean adding dynamic endpoints for load
balancer and 
send using a producer template. 



--
View this message in context: http://camel.465427.n5.nabble.com/LoadBalancing-to-a-dynamic-list-of-endpoints-tp1705611p5798495.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: LoadBalancing to a dynamic list of endpoints

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

Just use a processor / bean and do you own load balancing logic and
send using a producer template.

On Wed, Jul 21, 2010 at 1:06 PM, Cappa Roberto
<ro...@guest.telecomitalia.it> wrote:
> Hi,
>
> I need to loadBalance with failover to a list of final endpoints that can be dynamically calculated, so I cannot use ".to()" after the failover clause
> I've tryed in this way, using the recipient list:
>
> from("jetty:....")
>                .process(new Processor() {
>                    public void process(Exchange exc) throws Exception {
>                        exc.getIn().setHeader("urls",
>                                "http://url1,http://url2");
>                    }
>                })
>                .loadBalance()
>                .failover(-1, true, true)
>                .recipientList(header("urls").tokenize(","));
>
> But it doesn't work, because the recipient list is not used in round-robin way.
>
> Any idea?
>
> Thanks.



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus