You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by tan <ta...@stee.stengg.com> on 2012/02/02 09:57:02 UTC

Loadbalance failover with recipientList

Hi, I would like to know if loadBalance is able to failover to a dynamic
destination using recipientList or routingSlip?

I'm using Camel 2.4.0 pointing to 2 JBoss AS 5.1. My program is supposed to
check the contents of a file and route it to the specified site's JBoss. If
that site's primary JBoss dies, then it should route to the secondary JBoss.
My routing slip is below:

from("file://c:/test)
.routingSlip(SLIP_HEADER)
.loadBalance(new
FailoverProcessor()).failover(1,false,false,JMSException.class)
.routingSlip(SLIP_HEADER)

The first routing slip is to route dynamically to a site. If connection
fails, the FailoverProcessor will update the SLIP_HEADER to the site's
secondary route.

It only works if I define the endpoint statically but it's not what I need:

from("file://c:/test)
.routingSlip(SLIP_HEADER)
.loadBalance().failover(1,false,false,JMSException.class)
.to(primary_jms).to(secondary_jms)

Thanks a lot for the help.

--
View this message in context: http://camel.465427.n5.nabble.com/Loadbalance-failover-with-recipientList-tp5450056p5450056.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Loadbalance failover with recipientList

Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Feb 3, 2012 at 1:52 AM, tan <ta...@stee.stengg.com> wrote:
> Thanks for the reply. I've modified it to using recipientList but the end
> result is still the same:
>
> .loadBalance(new
> FailoverProcessor()).failover(1,false,false,JMSException.class)
> .recipientList(simple("${header.slip}")
>
> I noticed that the code in the FailoverProcessor is not called at all when
> the primary jms queue died. Can the SimpleLoadBalancerSupport be used
> together with failover?
>

Camel calls getProcessors() when it process a message. But only once.
And the failover LB will then use the processors returned from
getProcessors() in its failover logic.


> --
> View this message in context: http://camel.465427.n5.nabble.com/Loadbalance-failover-with-recipientList-tp5450056p5452429.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: Loadbalance failover with recipientList

Posted by tan <ta...@stee.stengg.com>.
Thanks for the reply. I've modified it to using recipientList but the end
result is still the same:

.loadBalance(new
FailoverProcessor()).failover(1,false,false,JMSException.class) 
.recipientList(simple("${header.slip}")

I noticed that the code in the FailoverProcessor is not called at all when
the primary jms queue died. Can the SimpleLoadBalancerSupport be used
together with failover?

--
View this message in context: http://camel.465427.n5.nabble.com/Loadbalance-failover-with-recipientList-tp5450056p5452429.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Loadbalance failover with recipientList

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

Try using the dynamic router EIP instead of routing slip.
Then you can failover in the dynamic logic. And remember to return
null, from the dynamic router, when you are done routing.

Alternatively you can failover and have the recipient list as the 2nd,
eg see this FAQ
http://camel.apache.org/how-do-i-use-dynamic-uri-in-to.html



On Thu, Feb 2, 2012 at 9:57 AM, tan <ta...@stee.stengg.com> wrote:
> Hi, I would like to know if loadBalance is able to failover to a dynamic
> destination using recipientList or routingSlip?
>
> I'm using Camel 2.4.0 pointing to 2 JBoss AS 5.1. My program is supposed to
> check the contents of a file and route it to the specified site's JBoss. If
> that site's primary JBoss dies, then it should route to the secondary JBoss.
> My routing slip is below:
>
> from("file://c:/test)
> .routingSlip(SLIP_HEADER)
> .loadBalance(new
> FailoverProcessor()).failover(1,false,false,JMSException.class)
> .routingSlip(SLIP_HEADER)
>
> The first routing slip is to route dynamically to a site. If connection
> fails, the FailoverProcessor will update the SLIP_HEADER to the site's
> secondary route.
>
> It only works if I define the endpoint statically but it's not what I need:
>
> from("file://c:/test)
> .routingSlip(SLIP_HEADER)
> .loadBalance().failover(1,false,false,JMSException.class)
> .to(primary_jms).to(secondary_jms)
>
> Thanks a lot for the help.
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Loadbalance-failover-with-recipientList-tp5450056p5450056.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/