This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 0231a1cecb933ae0a6781b732f43d13e39ef22c4
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Mon Oct 11 14:00:53 2021 +0200

    CAMEL-16861: Cleanup and update EIP docs
---
 .../modules/eips/pages/customLoadBalancer-eip.adoc | 17 ++++++-----
 .../main/docs/modules/eips/pages/sticky-eip.adoc   | 21 ++++++++-----
 .../main/docs/modules/eips/pages/topic-eip.adoc    | 17 +++++++----
 .../main/docs/modules/eips/pages/weighted-eip.adoc | 34 +++++++++++++---------
 4 files changed, 56 insertions(+), 33 deletions(-)

diff --git 
a/core/camel-core-engine/src/main/docs/modules/eips/pages/customLoadBalancer-eip.adoc
 
b/core/camel-core-engine/src/main/docs/modules/eips/pages/customLoadBalancer-eip.adoc
index 89d5dd5..33b1935 100644
--- 
a/core/camel-core-engine/src/main/docs/modules/eips/pages/customLoadBalancer-eip.adoc
+++ 
b/core/camel-core-engine/src/main/docs/modules/eips/pages/customLoadBalancer-eip.adoc
@@ -20,7 +20,10 @@ An example using Java DSL:
 from("direct:start")
     // using our custom load balancer
     .loadBalance(new MyLoadBalancer())
-    .to("mock:x", "mock:y", "mock:z");
+        .to("seda:x")
+        .to("seda:y")
+        .to("seda:z")
+    .end();
 ----
 
 And the same example using XML DSL:
@@ -28,18 +31,18 @@ And the same example using XML DSL:
 [source,xml]
 ----
 <!-- this is the implementation of our custom load balancer -->
-<bean id="myBalancer" 
class="org.apache.camel.processor.CustomLoadBalanceTest$MyLoadBalancer"/>
+<bean id="myBalancer" class="com.foo.MyLoadBalancer"/>
 
 <camelContext xmlns="http://camel.apache.org/schema/spring";>
   <route>
     <from uri="direct:start"/>
     <loadBalance>
       <!-- refer to my custom load balancer -->
-      <custom ref="myBalancer"/>
-      <!-- these are the endpoints to balancer -->
-      <to uri="mock:x"/>
-      <to uri="mock:y"/>
-      <to uri="mock:z"/>
+      <customLoadBalancer ref="myBalancer"/>
+      <!-- these are the endpoints to balance -->
+      <to uri="seda:x"/>
+      <to uri="seda:y"/>
+      <to uri="seda:z"/>
     </loadBalance>
   </route>
 </camelContext>
diff --git 
a/core/camel-core-engine/src/main/docs/modules/eips/pages/sticky-eip.adoc 
b/core/camel-core-engine/src/main/docs/modules/eips/pages/sticky-eip.adoc
index d64bfda..7f733ed 100644
--- a/core/camel-core-engine/src/main/docs/modules/eips/pages/sticky-eip.adoc
+++ b/core/camel-core-engine/src/main/docs/modules/eips/pages/sticky-eip.adoc
@@ -5,7 +5,10 @@
 :since: 
 :supportlevel: Stable
 
-Sticky Load Balancer. Sticky load balancing uses an Expression to calculate a 
correlation key to perform the sticky load balancing.
+Sticky mode for the xref:loadBalance-eip.adoc[Load Balancer] EIP.
+
+A stick mode means that a correlation key (calculated as 
xref:latest@manual:ROOT:expression.adoc[Expression])
+is used to determine the destination. This allows to route all messages with 
the same key to the same destination.
 
 == Options
 
@@ -15,29 +18,33 @@ include::partial$eip-options.adoc[]
 
 == Examples
 
-In this case we are using the header test as correlation expression:
+In this case we are using the header myKey as correlation expression:
 
 [source,java]
 ----
 from("direct:start")
-    .loadBalance()
-    .sticky(header("test"))
-    .to("seda:x", "seda:y", "seda:z");
+    .loadBalance().sticky(header("myKey"))
+        .to("seda:x")
+        .to("seda:y")
+        .to("seda:z")
+    .end();
 ----
 
-In XML you'll have a route like this
+In XML you'll have a route like this:
 
 [source,xml]
 ----
+<route>
 <from uri="direct:start"/>
     <loadBalance>
        <sticky>
            <correlationExpression>
-               <header>test</header>
+               <header>myKey</header>
            </correlationExpression>
        </sticky>
        <to uri="seda:x"/>      
        <to uri="seda:y"/>      
        <to uri="seda:z"/>       
     </loadBalance> 
+</route>
 ----
diff --git 
a/core/camel-core-engine/src/main/docs/modules/eips/pages/topic-eip.adoc 
b/core/camel-core-engine/src/main/docs/modules/eips/pages/topic-eip.adoc
index a4898f8..1d40bff 100644
--- a/core/camel-core-engine/src/main/docs/modules/eips/pages/topic-eip.adoc
+++ b/core/camel-core-engine/src/main/docs/modules/eips/pages/topic-eip.adoc
@@ -5,7 +5,8 @@
 :since: 
 :supportlevel: Stable
 
-Topic Load Balancer, with this policy you'll get a Topic behavior by sending 
to all destinations.
+Topic mode for the xref:loadBalance-eip.adoc[Load Balancer] EIP.
+With this policy then all destination is selected.
 
 == Options
 
@@ -15,20 +16,23 @@ include::partial$eip-options.adoc[]
 
 == Examples
 
-In this case we are using the header test as correlation expression:
+In this example we send the message to all three endpoints:
 
 [source,java]
 ----
 from("direct:start")
-    .loadBalance()
-    .topic()
-    .to("seda:x", "seda:y", "seda:z");
+    .loadBalance().topic()
+        .to("seda:x")
+        .to("seda:y")
+        .to("seda:z")
+    .end();
 ----
 
-In XML you'll have a route like this
+In XML you'll have a route like this:
 
 [source,xml]
 ----
+<route>
 <from uri="direct:start"/>
     <loadBalance>
        <topic/>
@@ -36,4 +40,5 @@ In XML you'll have a route like this
        <to uri="seda:y"/>      
        <to uri="seda:z"/>       
     </loadBalance> 
+</route>
 ----
diff --git 
a/core/camel-core-engine/src/main/docs/modules/eips/pages/weighted-eip.adoc 
b/core/camel-core-engine/src/main/docs/modules/eips/pages/weighted-eip.adoc
index d4c2d17..df7c433 100644
--- a/core/camel-core-engine/src/main/docs/modules/eips/pages/weighted-eip.adoc
+++ b/core/camel-core-engine/src/main/docs/modules/eips/pages/weighted-eip.adoc
@@ -5,7 +5,8 @@
 :since: 
 :supportlevel: Stable
 
-Weighted Load Balancer, with this policy in case of failures the exchange will 
be tried on the next endpoint.
+Weighted mode for xref:loadBalance-eip.adoc[Load Balancer] EIP.
+With this policy in case of failures the exchange will be tried on the next 
endpoint.
 
 == Options
 
@@ -15,25 +16,32 @@ include::partial$eip-options.adoc[]
 
 == Examples
 
-In this case we are using the header test as correlation expression:
+In this example we want to send the most message to the first endpoint, then 
the second, and only a few to the last.
+
+The distribution ratio is 7 = 4 + 2 + 1.
+This means that for every 7 message then 4 goes to the 1st, 2 for the 2nd, and 
1 for the last.
 
 [source,java]
 ----
 from("direct:start")
-    .loadBalance()
-    .weighted(false, "4,2,1")
-    .to("seda:x", "seda:y", "seda:z");
+    .loadBalance().weighted(false, "4,2,1")
+        .to("seda:x")
+        .to("seda:y")
+        .to("seda:z")
+    .end();
 ----
 
-In XML you'll have a route like this
+In XML you'll have a route like this:
 
 [source,xml]
 ----
-<from uri="direct:start"/> 
-  <loadBalance> 
-    <weighted roundRobin="false" distributionRatio="4 2 1"/> 
-    <to uri="seda:x"/> 
-    <to uri="seda:y"/> 
-    <to uri="seda:z"/> 
-  </loadBalance>
+<route>
+    <from uri="direct:start"/>
+      <loadBalance>
+        <weighted distributionRatio="4 2 1"/>
+        <to uri="seda:x"/>
+        <to uri="seda:y"/>
+        <to uri="seda:z"/>
+      </loadBalance>
+</route>
 ----

Reply via email to