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 b19b1c3eeabb91d1d06cd814c131cd712edf665d Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Mon Oct 11 13:46:59 2021 +0200 CAMEL-16861: Cleanup and update EIP docs --- .../docs/modules/eips/pages/loadBalance-eip.adoc | 4 +-- .../main/docs/modules/eips/pages/random-eip.adoc | 37 +++++++++++++++++++++- .../docs/modules/eips/pages/roundRobin-eip.adoc | 35 ++++++++++++-------- .../apache/camel/model/loadbalancer/random.json | 2 +- .../camel/model/loadbalancer/roundRobin.json | 2 +- .../loadbalancer/RandomLoadBalancerDefinition.java | 2 +- .../RoundRobinLoadBalancerDefinition.java | 4 +-- 7 files changed, 65 insertions(+), 21 deletions(-) diff --git a/core/camel-core-engine/src/main/docs/modules/eips/pages/loadBalance-eip.adoc b/core/camel-core-engine/src/main/docs/modules/eips/pages/loadBalance-eip.adoc index 3133c48..146e337 100644 --- a/core/camel-core-engine/src/main/docs/modules/eips/pages/loadBalance-eip.adoc +++ b/core/camel-core-engine/src/main/docs/modules/eips/pages/loadBalance-eip.adoc @@ -16,8 +16,8 @@ Camel provides the following policies out-of-the-box: | Policy | Description | xref:customLoadBalancer-eip.adoc[Custom Load Balancer] | To use a custom load balancer implementation. | xref:failover-eip.adoc[Failover Load Balancer] | In case of failures the exchange will be tried on the next endpoint. -| xref:roundRobin-eip.adoc[Round Robin Load Balancer] | The exchanges are selected in a round robin fashion. This is a well known and classic policy, which spreads the load evenly. -| xref:random-eip.adoc[Random Load Balancer] | A random endpoint is selected for each exchange. +| xref:roundRobin-eip.adoc[Round Robin Load Balancer] | The destination endpoints are selected in a round-robin fashion. This is a well known and classic policy, which spreads the load evenly. +| xref:random-eip.adoc[Random Load Balancer] | The destination endpoints are selected by random. | xref:sticky-eip.adoc[Sticky Load Balancer] | Sticky load balancing using an xref:latest@manual:ROOT:expression.adoc[Expression] to calculate a correlation key to perform the sticky load balancing. | xref:topic-eip.adoc[Topic Load Balancer] | Topic which sends to all destinations. | xref:weighted-eip.adoc[Weighted Loader Balancer] | Uses a weighted load distribution ratio for each server with respect to others. diff --git a/core/camel-core-engine/src/main/docs/modules/eips/pages/random-eip.adoc b/core/camel-core-engine/src/main/docs/modules/eips/pages/random-eip.adoc index 1bfcd1e..a3be019 100644 --- a/core/camel-core-engine/src/main/docs/modules/eips/pages/random-eip.adoc +++ b/core/camel-core-engine/src/main/docs/modules/eips/pages/random-eip.adoc @@ -1,11 +1,46 @@ = Random EIP :doctitle: Random :shortname: random -:description: A random endpoint is selected for each exchange. +:description: The destination endpoints are selected by random. :since: :supportlevel: Stable +Random mode for the xref:loadBalance-eip.adoc[Load Balancer] EIP. + +The destination endpoints are selected by random. +This is a well known and classic policy, which spreads the load randomly. // eip options: START include::partial$eip-options.adoc[] // eip options: END + +== Example + +We want to load balance between three endpoints in random mode. + +This is done as follows in Java DSL: + +[source,java] +---- +from("direct:start") + .loadBalance().ramdom() + .to("seda:x") + .to("seda:y") + .to("seda:z") + .end(); +---- + +In XML you'll have a route like this: + +[source,xml] +---- +<route> + <from uri="direct:start"/> + <loadBalance> + <ramdom/> + <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/roundRobin-eip.adoc b/core/camel-core-engine/src/main/docs/modules/eips/pages/roundRobin-eip.adoc index ab441a3..2586dd7 100644 --- a/core/camel-core-engine/src/main/docs/modules/eips/pages/roundRobin-eip.adoc +++ b/core/camel-core-engine/src/main/docs/modules/eips/pages/roundRobin-eip.adoc @@ -1,11 +1,14 @@ = Round Robin EIP :doctitle: Round Robin :shortname: roundRobin -:description: The exchanges are selected in a round robin fashion. This is a well known and classic policy, which spreads the load evenly. +:description: The destination endpoints are selected in a round-robin fashion. This is a well known and classic policy, which spreads the load evenly. :since: :supportlevel: Stable -Round Robin Load Balancer. With this Load Balancing policy, a random endpoint is selected for each exchange. +Round Robin mode for the xref:loadBalance-eip.adoc[Load Balancer] EIP. + +The exchanges are selected in a round-robin fashion. +This is a well known and classic policy, which spreads the load evenly. == Options @@ -13,27 +16,33 @@ Round Robin Load Balancer. With this Load Balancing policy, a random endpoint is include::partial$eip-options.adoc[] // eip options: END -== Examples +== Example + +We want to load balance between three endpoints in round-robin mode. -In this case we are using the header test as correlation expression: +This is done as follows in Java DSL: [source,java] ---- from("direct:start") - .loadBalance() - .roundRobin() - .to("seda:x", "seda:y", "seda:z"); + .loadBalance().roundRobin() + .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"/> +<route> + <from uri="direct:start"/> <loadBalance> <roundRobin/> - <to uri="seda:x"/> - <to uri="seda:y"/> - <to uri="seda:z"/> - </loadBalance> + <to uri="seda:x"/> + <to uri="seda:y"/> + <to uri="seda:z"/> + </loadBalance> +</route> ---- diff --git a/core/camel-core-model/src/generated/resources/org/apache/camel/model/loadbalancer/random.json b/core/camel-core-model/src/generated/resources/org/apache/camel/model/loadbalancer/random.json index 9dda75d..4280356 100644 --- a/core/camel-core-model/src/generated/resources/org/apache/camel/model/loadbalancer/random.json +++ b/core/camel-core-model/src/generated/resources/org/apache/camel/model/loadbalancer/random.json @@ -3,7 +3,7 @@ "kind": "model", "name": "random", "title": "Random", - "description": "A random endpoint is selected for each exchange.", + "description": "The destination endpoints are selected by random.", "deprecated": false, "label": "eip,routing", "javaType": "org.apache.camel.model.loadbalancer.RandomLoadBalancerDefinition", diff --git a/core/camel-core-model/src/generated/resources/org/apache/camel/model/loadbalancer/roundRobin.json b/core/camel-core-model/src/generated/resources/org/apache/camel/model/loadbalancer/roundRobin.json index 52b5cd9..da29615 100644 --- a/core/camel-core-model/src/generated/resources/org/apache/camel/model/loadbalancer/roundRobin.json +++ b/core/camel-core-model/src/generated/resources/org/apache/camel/model/loadbalancer/roundRobin.json @@ -3,7 +3,7 @@ "kind": "model", "name": "roundRobin", "title": "Round Robin", - "description": "The exchanges are selected in a round robin fashion. This is a well known and classic policy, which spreads the load evenly.", + "description": "The destination endpoints are selected in a round-robin fashion. This is a well known and classic policy, which spreads the load evenly.", "deprecated": false, "label": "eip,routing", "javaType": "org.apache.camel.model.loadbalancer.RoundRobinLoadBalancerDefinition", diff --git a/core/camel-core-model/src/main/java/org/apache/camel/model/loadbalancer/RandomLoadBalancerDefinition.java b/core/camel-core-model/src/main/java/org/apache/camel/model/loadbalancer/RandomLoadBalancerDefinition.java index b867281..f6b96fd 100644 --- a/core/camel-core-model/src/main/java/org/apache/camel/model/loadbalancer/RandomLoadBalancerDefinition.java +++ b/core/camel-core-model/src/main/java/org/apache/camel/model/loadbalancer/RandomLoadBalancerDefinition.java @@ -24,7 +24,7 @@ import org.apache.camel.model.LoadBalancerDefinition; import org.apache.camel.spi.Metadata; /** - * A random endpoint is selected for each exchange. + * The destination endpoints are selected by random. */ @Metadata(label = "eip,routing") @XmlRootElement(name = "random") diff --git a/core/camel-core-model/src/main/java/org/apache/camel/model/loadbalancer/RoundRobinLoadBalancerDefinition.java b/core/camel-core-model/src/main/java/org/apache/camel/model/loadbalancer/RoundRobinLoadBalancerDefinition.java index 4c1dfa2..41a6960 100644 --- a/core/camel-core-model/src/main/java/org/apache/camel/model/loadbalancer/RoundRobinLoadBalancerDefinition.java +++ b/core/camel-core-model/src/main/java/org/apache/camel/model/loadbalancer/RoundRobinLoadBalancerDefinition.java @@ -24,8 +24,8 @@ import org.apache.camel.model.LoadBalancerDefinition; import org.apache.camel.spi.Metadata; /** - * The exchanges are selected in a round robin fashion. This is a well known and classic policy, which spreads the load - * evenly. + * The destination endpoints are selected in a round-robin fashion. This is a well known and classic policy, which + * spreads the load evenly. */ @Metadata(label = "eip,routing") @XmlRootElement(name = "roundRobin")