Author: davsclaus
Date: Wed Nov  7 08:59:19 2012
New Revision: 1406502

URL: http://svn.apache.org/viewvc?rev=1406502&view=rev
Log:
CAMEL-5775: Improved loadbalancer example to use failover LB.

Modified:
    camel/trunk/examples/camel-example-loadbalancing/   (props changed)
    camel/trunk/examples/camel-example-loadbalancing/README.txt
    
camel/trunk/examples/camel-example-loadbalancing/src/main/resources/META-INF/spring/camel-context-loadbalancer.xml

Propchange: camel/trunk/examples/camel-example-loadbalancing/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Nov  7 08:59:19 2012
@@ -14,3 +14,4 @@ eclipse-classes
 *.ipr
 *.iml
 *.iws
+*.idea

Modified: camel/trunk/examples/camel-example-loadbalancing/README.txt
URL: 
http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-loadbalancing/README.txt?rev=1406502&r1=1406501&r2=1406502&view=diff
==============================================================================
--- camel/trunk/examples/camel-example-loadbalancing/README.txt (original)
+++ camel/trunk/examples/camel-example-loadbalancing/README.txt Wed Nov  7 
08:59:19 2012
@@ -8,12 +8,14 @@ separate JVMs. The load balancer pattern
 sending in Round Robin mode the messages created from a Camel Bean component
 alternatively between each server running on localhost:9991 and localhost:9992.
 
-Within this demo every five seconds, a Report object is created from the Camel 
load balancer server.
+Within this demo every ten seconds, a Report object is created from the Camel 
load balancer server.
 This object is sent by the Camel load balancer to a MINA server where the 
object is then serialized.
 One of the two MINA servers (localhost:9991 and localhost:9992) receives the 
object and enriches 
 the message by setting the field reply of the Report object. The reply is sent 
back by the MINA 
 server to the client, which then logs the reply on the console.
 
+If any of the two MINA servers is not running, then the load balancer will 
automatic failover
+to the next server.
 
 Running the example
 ===================

Modified: 
camel/trunk/examples/camel-example-loadbalancing/src/main/resources/META-INF/spring/camel-context-loadbalancer.xml
URL: 
http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-loadbalancing/src/main/resources/META-INF/spring/camel-context-loadbalancer.xml?rev=1406502&r1=1406501&r2=1406502&view=diff
==============================================================================
--- 
camel/trunk/examples/camel-example-loadbalancing/src/main/resources/META-INF/spring/camel-context-loadbalancer.xml
 (original)
+++ 
camel/trunk/examples/camel-example-loadbalancing/src/main/resources/META-INF/spring/camel-context-loadbalancer.xml
 Wed Nov  7 08:59:19 2012
@@ -34,12 +34,14 @@
       <to uri="direct:loadbalance"/>
     </route>
 
+               <!-- use failover load balancer in round robin mode, to 
automatic failover to next server
+                    in case of failure -->
     <route id="loadbalancer">
       <from uri="direct:loadbalance"/>
-      <loadBalance>
-        <roundRobin/>
-        <to 
uri="mina:tcp://localhost:9991?sync=true&amp;allowDefaultCodec=true"/>
-        <to 
uri="mina:tcp://localhost:9992?sync=true&amp;allowDefaultCodec=true"/>
+      <loadBalance inheritErrorHandler="false">
+        <failover roundRobin="true"/>
+        <to uri="mina:tcp://localhost:9991?sync=true"/>
+        <to uri="mina:tcp://localhost:9992?sync=true"/>
       </loadBalance>
       <log message="${body}"/>
     </route>


Reply via email to