This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch docs/yaml-dsl-tabs-alignment in repository https://gitbox.apache.org/repos/asf/camel.git
commit ff6282d860e3bd418d70f5e50ef771eb4168d495 Author: Claus Ibsen <[email protected]> AuthorDate: Sun Jun 14 22:21:32 2026 +0200 docs: add YAML DSL tabs to EIP and user-manual documentation Add missing YAML DSL examples to [tabs] blocks in documentation files that already had Java and XML DSL examples but were missing the YAML variant. All YAML snippets were validated against the Camel YAML DSL JSON schema. Files updated: - dead-letter-channel.adoc: 6 YAML tabs for errorHandler configurations - message-history.adoc: 1 YAML tab for errorHandler with route - transactional-client.adoc: 3 YAML tabs for transacted routes - http-session-handling.adoc: 1 YAML tab for session handling routes Co-Authored-By: Claude <[email protected]> Signed-off-by: Claus Ibsen <[email protected]> --- .../modules/eips/pages/dead-letter-channel.adoc | 66 ++++++++++++++++ .../docs/modules/eips/pages/message-history.adoc | 21 +++++ .../modules/eips/pages/transactional-client.adoc | 91 ++++++++++++++++++++++ .../modules/ROOT/pages/http-session-handling.adoc | 36 +++++++++ 4 files changed, 214 insertions(+) diff --git a/core/camel-core-engine/src/main/docs/modules/eips/pages/dead-letter-channel.adoc b/core/camel-core-engine/src/main/docs/modules/eips/pages/dead-letter-channel.adoc index 898361571fe1..29be04719ae1 100644 --- a/core/camel-core-engine/src/main/docs/modules/eips/pages/dead-letter-channel.adoc +++ b/core/camel-core-engine/src/main/docs/modules/eips/pages/dead-letter-channel.adoc @@ -46,6 +46,15 @@ Spring XML:: deadLetterUri="log:dead?level=ERROR"/> ---- +YAML:: ++ +[source,yaml] +---- +- errorHandler: + deadLetterChannel: + deadLetterUri: "log:dead?level=ERROR" +---- + ==== Pay attention to Spring XML DSL. The type attribute is used to declare which error handler to use, here its `DeadLetterChannel`. @@ -164,6 +173,18 @@ Spring XML:: </errorHandler> ---- +YAML:: ++ +[source,yaml] +---- +- errorHandler: + deadLetterChannel: + deadLetterUri: jms:queue:dead + redeliveryPolicy: + maximumRedeliveries: 3 + redeliveryDelay: "5000" +---- + ==== The Dead Letter error handler will clear the caused exception (`setException(null)`), by moving the caused exception to a property on the xref:manual::exchange.adoc[Exchange], with the key `Exchange.EXCEPTION_CAUGHT`. @@ -224,6 +245,19 @@ And in XML, you set `useOriginalMessage=true` on the `<errorHandler>` as shown: </errorHandler> ---- +YAML:: ++ +[source,yaml] +---- +- errorHandler: + deadLetterChannel: + deadLetterUri: jms:queue:dead + useOriginalMessage: true + redeliveryPolicy: + maximumRedeliveries: 5 + redeliveryDelay: "5000" +---- + ==== Then the messages routed to the `jms:queue:dead` is the original input. @@ -273,6 +307,18 @@ And in XML DSL, you specify a bean id via `onRedeliveryRef` on the `<errorHandle </errorHandler> ---- +YAML:: ++ +[source,yaml] +---- +- errorHandler: + deadLetterChannel: + deadLetterUri: jms:queue:dead + onRedeliveryRef: myRedeliveryProcessor + redeliveryPolicy: + maximumRedeliveries: 3 +---- + ==== TIP: Camel also supports xref:manual::exception-clause.adoc[onException] to use `onRedeliver`. @@ -321,6 +367,16 @@ Configuring this from Spring XML is done with the `onPrepareFailureRef` to refer <errorHandler id="dlc" type="DeadLetterChannel" deadLetterUri="jms:dead" onPrepareFailureRef="myPrepare"/> ---- +YAML:: ++ +[source,yaml] +---- +- errorHandler: + deadLetterChannel: + deadLetterUri: jms:dead + onPrepareFailureRef: myPrepare +---- + ==== === Calling a processor when an exception occurred @@ -365,6 +421,16 @@ Configuring this from Spring XML is done with the `onExceptionOccurredRef` to re <errorHandler id="dlc" type="DeadLetterChannel" deadLetterUri="jms:dead" onExceptionOccurredRef="myErrorLogger"/> ---- + +YAML:: ++ +[source,yaml] +---- +- errorHandler: + deadLetterChannel: + deadLetterUri: jms:dead + onExceptionOccurredRef: myErrorLogger +---- ==== diff --git a/core/camel-core-engine/src/main/docs/modules/eips/pages/message-history.adoc b/core/camel-core-engine/src/main/docs/modules/eips/pages/message-history.adoc index b1a63430576a..61724b99bc58 100644 --- a/core/camel-core-engine/src/main/docs/modules/eips/pages/message-history.adoc +++ b/core/camel-core-engine/src/main/docs/modules/eips/pages/message-history.adoc @@ -329,6 +329,27 @@ of the `<errorHandler>` as shown: </camelContext> ---- +YAML:: ++ +[source,yaml] +---- +- errorHandler: + defaultErrorHandler: + redeliveryPolicy: + logExhaustedMessageHistory: false + logExhaustedMessageBody: true +- route: + from: + uri: jms:cheese + steps: + - to: + uri: bean:validate + - to: + uri: bean:transform + - to: + uri: jms:wine +---- + ==== == MessageHistory API diff --git a/core/camel-core-engine/src/main/docs/modules/eips/pages/transactional-client.adoc b/core/camel-core-engine/src/main/docs/modules/eips/pages/transactional-client.adoc index cf98fe76fc48..3fc4990987a3 100644 --- a/core/camel-core-engine/src/main/docs/modules/eips/pages/transactional-client.adoc +++ b/core/camel-core-engine/src/main/docs/modules/eips/pages/transactional-client.adoc @@ -261,6 +261,42 @@ Spring XML:: </route> </camelContext> ---- + +YAML:: ++ +[source,yaml] +---- +- route: + from: + uri: activemq:queue:inbox + steps: + - transacted: + ref: txRequired + - to: + uri: direct:audit + - to: + uri: direct:order + - to: + uri: activemq:queue:order +- route: + from: + uri: direct:audit + steps: + - transacted: + ref: txRequiresNew + - bean: + ref: auditLogService + method: insertAuditLog +- route: + from: + uri: direct:order + steps: + - transacted: + ref: txMandatory + - bean: + ref: orderService + method: insertOrder +---- ==== Notice how the ref attribute on `<transacted>` refers to the corresponding bean id of the transaction policy. @@ -363,6 +399,46 @@ Spring XML:: </camelContext> ---- + +YAML:: ++ +[source,yaml] +---- +- route: + from: + uri: direct:okay + steps: + - transacted: {} + - setBody: + expression: + constant: + expression: Tiger in Action + - bean: + ref: bookService + - setBody: + expression: + constant: + expression: Elephant in Action + - bean: + ref: bookService +- route: + from: + uri: direct:fail + steps: + - transacted: {} + - setBody: + expression: + constant: + expression: Tiger in Action + - bean: + ref: bookService + - setBody: + expression: + constant: + expression: Donkey in Action + - bean: + ref: bookService +---- ==== That is all that is needed to configure a Camel route as being transacted. @@ -438,4 +514,19 @@ Spring XML:: </route> </camelContext> ---- + +YAML:: ++ +[source,yaml] +---- +- route: + from: + uri: activemq:queue:okay + steps: + - transacted: {} + - process: + ref: myProcessor + - to: + uri: mock:result +---- ==== diff --git a/docs/user-manual/modules/ROOT/pages/http-session-handling.adoc b/docs/user-manual/modules/ROOT/pages/http-session-handling.adoc index 595ae530b211..8d06be9e1aa2 100644 --- a/docs/user-manual/modules/ROOT/pages/http-session-handling.adoc +++ b/docs/user-manual/modules/ROOT/pages/http-session-handling.adoc @@ -107,6 +107,42 @@ Spring XML:: <bean id="instanceCookieHandler" class="org.apache.camel.http.common.cookie.InstanceCookieHandler"/> <bean id="exchangeCookieHandler" class="org.apache.camel.http.common.cookie.ExchangeCookieHandler"/> ---- + +YAML:: ++ +[source,yaml] +---- +- route: + from: + uri: direct://proxy + steps: + - to: + uri: cxfrs://bean://rsClientProxy + - convertBodyTo: + type: java.lang.String + - to: + uri: cxfrs://bean://rsClientProxy +- route: + from: + uri: direct://proxyinstance + steps: + - to: + uri: "cxfrs://bean://rsClientProxy?cookieHandler=#instanceCookieHandler" + - convertBodyTo: + type: java.lang.String + - to: + uri: "cxfrs://bean://rsClientProxy?cookieHandler=#instanceCookieHandler" +- route: + from: + uri: direct://proxyexchange + steps: + - to: + uri: "cxfrs://bean://rsClientProxy?cookieHandler=#exchangeCookieHandler" + - convertBodyTo: + type: java.lang.String + - to: + uri: "cxfrs://bean://rsClientProxy?cookieHandler=#exchangeCookieHandler" +---- ==== Both `CookieHandler` implementations support setting a CookiePolicy to control the policy for storing
