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 5edb59d2ba2a CAMEL-16861: Update docs
5edb59d2ba2a is described below
commit 5edb59d2ba2aa86824ce03f3ea035859c43fe31a
Author: Claus Ibsen <[email protected]>
AuthorDate: Sat Feb 14 21:05:19 2026 +0100
CAMEL-16861: Update docs
---
.../modules/eips/pages/fault-tolerance-eip.adoc | 93 +++++++++++++-
.../main/docs/modules/eips/pages/filter-eip.adoc | 137 ++++++++++++++++++---
2 files changed, 211 insertions(+), 19 deletions(-)
diff --git
a/core/camel-core-engine/src/main/docs/modules/eips/pages/fault-tolerance-eip.adoc
b/core/camel-core-engine/src/main/docs/modules/eips/pages/fault-tolerance-eip.adoc
index 00d3c7fb40b9..27eb542f4ec3 100644
---
a/core/camel-core-engine/src/main/docs/modules/eips/pages/fault-tolerance-eip.adoc
+++
b/core/camel-core-engine/src/main/docs/modules/eips/pages/fault-tolerance-eip.adoc
@@ -55,6 +55,28 @@ XML::
<to uri="mock:result"/>
</route>
----
+
+YAML::
++
+[source,yaml]
+----
+- route:
+ from:
+ uri: direct:start
+ steps:
+ - circuitBreaker:
+ steps:
+ - onFallback:
+ steps:
+ - transform:
+ expression:
+ constant:
+ expression: Fallback message
+ - to:
+ uri: http://fooservice.com/faulty
+ - to:
+ uri: mock:result
+----
====
In case the calling the downstream HTTP service is failing, and an exception
is thrown,
@@ -102,6 +124,29 @@ XML::
<log message="After Fault Tolerance: ${body}"/>
</route>
----
+
+YAML::
++
+[source,yaml]
+----
+- route:
+ from:
+ uri: direct:start
+ steps:
+ - circuitBreaker:
+ steps:
+ - faultToleranceConfiguration:
+ timeoutDuration: 2000
+ timeoutEnabled: "true"
+ - log:
+ message: "Fault Tolerance processing start: ${threadName}"
+ - to:
+ uri: http://fooservice.com/faulty
+ - log:
+ message: "Fault Tolerance processing end: ${threadName}"
+ - log:
+ message: "After Fault Tolerance: ${body}"
+----
====
In this example, if calling the downstream service does not return a response
within 2 seconds,
@@ -116,6 +161,11 @@ is not reacting also.
However, you can enable Camels error handler with circuit breaker by enabling
the `inheritErrorHandler` option, as shown:
+[tabs]
+====
+
+Java::
++
[source,java]
----
// Camel's error handler that will attempt to redeliver the message 3 times
@@ -132,6 +182,47 @@ from("direct:start")
.to("mock:result");
----
+XML::
++
+[source,xml]
+----
+<route>
+ <from uri="direct:start"/>
+ <to uri="log:start"/>
+ <circuitBreaker inheritErrorHandler="true">
+ <to uri="mock:a"/>
+ <throwException exceptionType="java.lang.IllegalArgumentException"
message="Forced"/>
+ </circuitBreaker>
+ <to uri="log:result"/>
+ <to uri="mock:result"/>
+</route>
+----
+
+YAML::
++
+[source,yaml]
+----
+- route:
+ from:
+ uri: direct:start
+ steps:
+ - to:
+ uri: log:start
+ - circuitBreaker:
+ inheritErrorHandler: "true"
+ steps:
+ - to:
+ uri: mock:a
+ - throwException:
+ exceptionType: "java.lang.IllegalArgumentException"
+ message: "Forced"
+ - to:
+ uri: log:result
+ - to:
+ uri: mock:result
+----
+====
+
This example is from a test, where you can see the Circuit Breaker EIP block
has been hardcoded
to always fail by throwing an exception. Because the `inheritErrorHandler` has
been enabled,
then Camel's error handler will attempt to call the Circuit Breaker EIP block
again.
@@ -164,6 +255,6 @@ Maven users will need to add the following dependency to
their pom.xml to use th
=== Using Fault Tolerance with Spring Boot
-This component does not support Spring Boot.
+This component is **not supported** Spring Boot.
Instead, it is supported in Standalone and with Camel Quarkus.
diff --git
a/core/camel-core-engine/src/main/docs/modules/eips/pages/filter-eip.adoc
b/core/camel-core-engine/src/main/docs/modules/eips/pages/filter-eip.adoc
index be8f28c735c1..88470863ec99 100644
--- a/core/camel-core-engine/src/main/docs/modules/eips/pages/filter-eip.adoc
+++ b/core/camel-core-engine/src/main/docs/modules/eips/pages/filter-eip.adoc
@@ -63,6 +63,25 @@ XML::
<to uri="direct:b"/>
</route>
----
+
+YAML::
++
+[source,yaml]
+----
+- route:
+ from:
+ uri: direct:a
+ steps:
+ - filter:
+ expression:
+ simple:
+ expression: "${header.foo} == 'bar'"
+ steps:
+ - to:
+ uri: direct:bar
+ - to:
+ uri: direct:b
+----
====
You can use many languages as the predicate, such as
xref:languages:xpath-language.adoc[XPath]:
@@ -90,6 +109,23 @@ XML::
</filter>
</route>
----
+
+YAML::
++
+[source,yaml]
+----
+- route:
+ from:
+ uri: direct:start
+ steps:
+ - filter:
+ expression:
+ xpath:
+ expression: "/person[@name='James']"
+ steps:
+ - to:
+ uri: mock:result
+----
====
Here is another example of calling a xref:languages:bean-language.adoc[method
on a bean]
@@ -125,13 +161,33 @@ of the bean as shown:
<route>
<from uri="direct:start"/>
<filter>
- <method type="com.foo.MyBean" method="isGoldCustomer"/>
+ <method beanType="com.foo.MyBean" method="isGoldCustomer"/>
<to uri="mock:gold"/>
</filter>
<to uri="mock:all"/>
</route>
----
+And similar in YAML DSL:
+
+[source,yaml]
+----
+- route:
+ from:
+ uri: direct:start
+ steps:
+ - filter:
+ expression:
+ method:
+ method: isGoldCustomer
+ beanType: com.foo.MyBean
+ steps:
+ - to:
+ uri: mock:gold
+ - to:
+ uri: mock:all
+----
+
=== Filtering with status property
To know whether an `Exchange` was filtered or not, then you can choose to
specify a name of a property
@@ -157,12 +213,33 @@ XML::
<route>
<from uri="direct:start"/>
<filter statusPropertyName="gold">
- <method type="com.foo.MyBean" method="isGoldCustomer"/>
+ <method beanType="com.foo.MyBean" method="isGoldCustomer"/>
<to uri="mock:gold"/>
</filter>
<to uri="mock:all"/>
</route>
----
+
+YAML::
++
+[source,yaml]
+----
+- route:
+ from:
+ uri: direct:start
+ steps:
+ - filter:
+ statusPropertyName: gold
+ expression:
+ method:
+ method: isGoldCustomer
+ beanType: com.foo.MyBean
+ steps:
+ - to:
+ uri: mock:gold
+ - to:
+ uri: mock:all
+----
====
In the example above then Camel will store an exchange property with key
`gold` with the result of the filtering,
@@ -172,36 +249,60 @@ whether it was `true` or `false`.
When using the Message Filter EIP, then it only applies to its children.
-For example, in the previous example:
-
-[source,xml]
-----
-<route>
- <from uri="direct:start"/>
- <filter>
- <method type="com.foo.MyBean" method="isGoldCustomer"/>
- <to uri="mock:gold"/>
- </filter>
- <to uri="mock:all"/>
-</route>
-----
-
-Then for a message that is a gold customer will be routed to both `mock:gold`
and `mock:all` (predicate is true).
+For example, in the previous example then for a message that is a gold
customer will be routed to both `mock:gold` and `mock:all` (predicate is true).
However, for a non-gold message (predicate is false) then the message will not
be routed in the filter block,
but will be routed to mock:all.
Sometimes you may want to stop routing for messages that were filtered.
To do this, you can use the xref:stop-eip.adoc[Stop] EIP as shown:
+[tabs]
+====
+Java::
++
+[source,java]
+----
+from("direct:start")
+ .filter().method(MyBean.class, "isGoldCustomer").statusPropertyName("gold")
+ .to("mock:gold")
+ .stop()
+ .end()
+ .to("mock:all");
+----
+
+XML::
++
[source,xml]
----
<route>
<from uri="direct:start"/>
<filter>
- <method type="com.foo.MyBean" method="isGoldCustomer"/>
+ <method beanType="com.foo.MyBean" method="isGoldCustomer"/>
<to uri="mock:gold"/>
<stop/>
</filter>
<to uri="mock:all"/>
</route>
----
+
+YAML::
++
+[source,yaml]
+----
+- route:
+ from:
+ uri: direct:start
+ steps:
+ - filter:
+ expression:
+ method:
+ method: isGoldCustomer
+ beanType: com.foo.MyBean
+ steps:
+ - to:
+ uri: mock:gold
+ - stop: {}
+ - to:
+ uri: mock:all
+----
+====