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
The following commit(s) were added to refs/heads/main by this push:
new 99142e0 CAMEL-16861: Cleanup and update EIP docs
99142e0 is described below
commit 99142e0eb29988b62ebba94f7d79afcd7628c2a5
Author: Claus Ibsen <[email protected]>
AuthorDate: Wed Sep 15 15:40:55 2021 +0200
CAMEL-16861: Cleanup and update EIP docs
---
.../modules/eips/pages/circuitBreaker-eip.adoc | 37 ++++++++++++----------
.../org/apache/camel/model/circuitBreaker.json | 1 +
.../camel/model/CircuitBreakerDefinition.java | 3 ++
3 files changed, 24 insertions(+), 17 deletions(-)
diff --git
a/core/camel-core-engine/src/main/docs/modules/eips/pages/circuitBreaker-eip.adoc
b/core/camel-core-engine/src/main/docs/modules/eips/pages/circuitBreaker-eip.adoc
index 95e8fc0..05f4e4e 100644
---
a/core/camel-core-engine/src/main/docs/modules/eips/pages/circuitBreaker-eip.adoc
+++
b/core/camel-core-engine/src/main/docs/modules/eips/pages/circuitBreaker-eip.adoc
@@ -16,7 +16,7 @@ image::eip/CircuitBreaker.png[image]
The states are as follows:
* *Closed* — When operating successfully.
-* *Open* — When failure is detected and the breaker opens to short-circuit and
fail
+* *Open* — When failure is detected, and the breaker opens to short-circuit
and fail
fast. In this state, the circuit breaker avoids invoking the protected
operation and
avoids putting additional load on the struggling service.
* *Half Open* — After a short period in the open state, an operation is
attempted to
@@ -38,7 +38,11 @@ The Circuit Breaker EIP supports 4 options which are listed
below:
== Example
-Below is an example route showing a circuit breaker endpoint that protects
against slow operation by falling back to the in-lined fallback route. By
default the timeout request is just *1000ms* so the HTTP endpoint has to be
fairly quick to succeed.
+Below is an example route showing a circuit breaker endpoint that protects
against
+slow operation by falling back to the in-lined fallback route.
+
+By default, the timeout request is just *1000ms, so the HTTP endpoint has to
be fairly quick to succeed.
+
[source,java]
----
from("direct:start")
@@ -51,25 +55,24 @@ from("direct:start")
----
And in XML DSL:
+
[source,xml]
----
-<camelContext xmlns="http://camel.apache.org/schema/spring">
- <route>
- <from uri="direct:start"/>
- <circuitBreaker>
- <to uri="http://fooservice.com/slow"/>
- <onFallback>
- <transform>
- <constant>Fallback message</constant>
- </transform>
- </onFallback>
- </circuitBreaker>
- <to uri="mock:result"/>
- </route>
-</camelContext>
+<route>
+ <from uri="direct:start"/>
+ <circuitBreaker>
+ <to uri="http://fooservice.com/slow"/>
+ <onFallback>
+ <transform>
+ <constant>Fallback message</constant>
+ </transform>
+ </onFallback>
+ </circuitBreaker>
+ <to uri="mock:result"/>
+</route>
----
-== CircuitBreaker Implementations
+== Circuit Breaker components
Camel provides three implementations of this pattern:
diff --git
a/core/camel-core-model/src/generated/resources/org/apache/camel/model/circuitBreaker.json
b/core/camel-core-model/src/generated/resources/org/apache/camel/model/circuitBreaker.json
index b0b7c64..70b2673 100644
---
a/core/camel-core-model/src/generated/resources/org/apache/camel/model/circuitBreaker.json
+++
b/core/camel-core-model/src/generated/resources/org/apache/camel/model/circuitBreaker.json
@@ -3,6 +3,7 @@
"kind": "model",
"name": "circuitBreaker",
"title": "Circuit Breaker",
+ "description": "Route messages in a fault tolerance way using Circuit
Breaker",
"deprecated": false,
"label": "eip,routing,circuitbreaker",
"javaType": "org.apache.camel.model.CircuitBreakerDefinition",
diff --git
a/core/camel-core-model/src/main/java/org/apache/camel/model/CircuitBreakerDefinition.java
b/core/camel-core-model/src/main/java/org/apache/camel/model/CircuitBreakerDefinition.java
index a248419..75e35a9 100644
---
a/core/camel-core-model/src/main/java/org/apache/camel/model/CircuitBreakerDefinition.java
+++
b/core/camel-core-model/src/main/java/org/apache/camel/model/CircuitBreakerDefinition.java
@@ -30,6 +30,9 @@ import javax.xml.bind.annotation.XmlTransient;
import org.apache.camel.spi.Metadata;
import org.apache.camel.spi.annotations.DslProperty;
+/**
+ * Route messages in a fault tolerance way using Circuit Breaker
+ */
@Metadata(label = "eip,routing,circuitbreaker")
@XmlRootElement(name = "circuitBreaker")
@XmlAccessorType(XmlAccessType.FIELD)