You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Martin Gilday <ma...@imap.cc> on 2010/04/20 11:01:02 UTC

Load Balancer Clarification

Hi,

I'm just reading through the Load Balancer docs [1] and would like some
clarification on how it works.

I have a JMS queue where each entry is the name of a file to print. 
This is consumed a printing component (our own not the Camel one) which
uses Ice PDF to render a PDF document and send to an office printer.  As
volume has increased we now have 3 printers to use.  We would like to
round robin around these 3 printers.

At times the printer can be in the state of "not accepting jobs", due to
things such as out of toner, out of paper, paper jam, malfunction etc. 
At the moment when this occurs we throw an exception and the error
handler retries with exponential backoff, then sends to a DLC.

In Camel 2.3 it seems I should be able to do something like:

from("jms:docs-to-print").loadBalance().failover(false, -1,
true).to("ice://printer1", "ice://printer2", "ice://printer3"));

1) Does this look correct?
2) Sometimes all 3 printers may be broken at once.  Can I still use
retrying with exponential backoff across the whole load balancer (i.e.
not retrying each node before it moves on, retrying the whole set after
a delay) and then send to a DLC after X attempts.

Thanks,
Martin

[1]http://camel.apache.org/load-balancer.html

Re: Load Balancer Clarification

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

On Tue, Apr 20, 2010 at 11:01 AM, Martin Gilday <ma...@imap.cc> wrote:
> Hi,
>
> I'm just reading through the Load Balancer docs [1] and would like some
> clarification on how it works.
>
> I have a JMS queue where each entry is the name of a file to print.
> This is consumed a printing component (our own not the Camel one) which
> uses Ice PDF to render a PDF document and send to an office printer.  As
> volume has increased we now have 3 printers to use.  We would like to
> round robin around these 3 printers.
>
> At times the printer can be in the state of "not accepting jobs", due to
> things such as out of toner, out of paper, paper jam, malfunction etc.
> At the moment when this occurs we throw an exception and the error
> handler retries with exponential backoff, then sends to a DLC.
>
> In Camel 2.3 it seems I should be able to do something like:
>
> from("jms:docs-to-print").loadBalance().failover(false, -1,
> true).to("ice://printer1", "ice://printer2", "ice://printer3"));
>
> 1) Does this look correct?

Yeah you are getting there. It will try forever until success.


> 2) Sometimes all 3 printers may be broken at once.  Can I still use
> retrying with exponential backoff across the whole load balancer (i.e.
> not retrying each node before it moves on, retrying the whole set after
> a delay) and then send to a DLC after X attempts.
>

It will only exhaust if maximumFailoverAttempts was hit.
In you case you set it to -1 which causes it to retry forever.
So you can set it to 3 which will have it try all 3 printers. Or 10 or
whatever you like.

The LB can be improved and patches is accepted :)
And you can implement your own balancer and use it.

Can you tell the difference if the printer is out of toner, or some
other condition?
We could enhance it with the redeliverUntil predicate so you can
determine in the predicate to retry or give up.



> Thanks,
> Martin
>
> [1]http://camel.apache.org/load-balancer.html
>



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