This is an automated email from the ASF dual-hosted git repository. orpiske pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
commit 27e97a01f86105f1d6b7d7fe9cf341b8e3fbb670 Author: Otavio R. Piske <angusyo...@gmail.com> AuthorDate: Sat Feb 24 13:36:13 2024 +0100 CAMEL-20459: documentation fixes for the fail-over EIP. Signed-off-by: Otavio R. Piske <angusyo...@gmail.com> --- .../main/docs/modules/eips/pages/failover-eip.adoc | 47 ++++++++++++++-------- 1 file changed, 31 insertions(+), 16 deletions(-) diff --git a/core/camel-core-engine/src/main/docs/modules/eips/pages/failover-eip.adoc b/core/camel-core-engine/src/main/docs/modules/eips/pages/failover-eip.adoc index 9842611ecd5..f83f1cbc4dc 100644 --- a/core/camel-core-engine/src/main/docs/modules/eips/pages/failover-eip.adoc +++ b/core/camel-core-engine/src/main/docs/modules/eips/pages/failover-eip.adoc @@ -6,7 +6,7 @@ :supportlevel: Stable :tabs-sync-option: -This EIP allows using fail-over (in case of failures the exchange will be tried on the next endpoint) +This EIP allows using fail-over (in case of failures, the exchange will be tried on the next endpoint) with the xref:loadBalance-eip.adoc[Load Balancer] EIP. == Options @@ -23,8 +23,13 @@ include::partial$eip-exchangeProperties.adoc[] == Example -In the example below calling the three http services is done with the load balancer. +In the example below, calling the three http services is done with the load balancer: +[tabs] +==== + +Java:: ++ [source,java] ---- from("direct:start") @@ -35,8 +40,8 @@ from("direct:start") .end(); ---- -In XML you'll have a route like this: - +XML:: ++ [source,xml] ---- <route> @@ -50,9 +55,11 @@ In XML you'll have a route like this: </route> ---- -In the default mode the fail-over load balancer will always start with the first processor (i.e. "http:service1"). +==== + +In the default mode, the fail-over load balancer will always start with the first processor (i.e., "http:service1"). And in case this fails, then try the next, until either it succeeded or all of them failed. -If all failed then Camel will throw the caused exception which means the Exchange is failed. +If all failed, then Camel will throw the caused exception which means the Exchange is failed. === Using round-robin mode @@ -77,10 +84,11 @@ from("direct:start") .failover(10, false, true) ---- -Where `10` is the maximum failover attempts, And `false` is a special feature -related to inheriting error handler. The last parameter `true` is to use round robin mode. +Where `10` is the maximum fail over attempts, And `false` is a special feature +related to inheriting error handler. +The last parameter `true` is to use round-robin mode. -In XML it is straightforward as shown: +In XML, it is straightforward as shown: [source,xml] ---- @@ -100,15 +108,20 @@ In XML it is straightforward as shown: The sticky mode is used for remember the last known good endpoint, so the next exchange will start from there, instead from the beginning. -For example support that http:service1 is down, and that service2 is up. +For example, support that http:service1 is down, and that service2 is up. With sticky mode enabled, then Camel will keep starting from service2 until it fails, and then try service3. -If sticky mode is not enabled (default) then Camel will always start from the beginning, which +If sticky mode is not enabled (it's disabled by default), then Camel will always start from the beginning, which means calling service1. -Setting sticky mode in Java DSL is not _pretty_ as there are four parameters: +[tabs] +==== +Java:: ++ +Setting sticky mode in Java DSL is not _pretty_ as there are four parameters. ++ [source,java] ---- from("direct:start") @@ -118,11 +131,11 @@ from("direct:start") .to("http:service3") .end(); ---- ++ +NOTE: The last `true` argument is to enable sticky mode. -The last `true` is to enable sticky mode. - -In XML it is straightforward as shown: - +XML:: ++ [source,xml] ---- <route> @@ -136,6 +149,8 @@ In XML it is straightforward as shown: </route> ---- +==== + === Fail-over on specific exceptions The fail-over load balancer can be configured to only apply for a specific set of exceptions.