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 9542b8a CAMEL-16861: Cleanup and update EIP docs 9542b8a is described below commit 9542b8ab567743e9ed5f12aceddd08cdf2060b72 Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Thu Oct 14 16:08:53 2021 +0200 CAMEL-16861: Cleanup and update EIP docs --- .../modules/eips/pages/message-translator.adoc | 30 +++++++++++++- .../docs/modules/eips/pages/transform-eip.adoc | 47 +++++++++++++++++++++- 2 files changed, 74 insertions(+), 3 deletions(-) diff --git a/core/camel-core-engine/src/main/docs/modules/eips/pages/message-translator.adoc b/core/camel-core-engine/src/main/docs/modules/eips/pages/message-translator.adoc index 7b0cae2..e8046c6 100644 --- a/core/camel-core-engine/src/main/docs/modules/eips/pages/message-translator.adoc +++ b/core/camel-core-engine/src/main/docs/modules/eips/pages/message-translator.adoc @@ -18,7 +18,35 @@ The Message Translator can be done in different ways in Camel: == Example -Each of above approaches is documented in the following examples +Each of above approaches is documented in the following examples: + +=== Message Translator with Transform EIP + +You can use a xref:transform-eip.adoc[Transform] which uses an +xref:latest@manual:ROOT:expression.adoc[Expression] to do the transformation: + +In the example below we prepend Hello to the message body using the +xref:components:languages:simple-language.adoc[Simple] language: + +[source,java] +---- +from("direct:cheese") + .setBody(simple("Hello ${body}")) + .to("log:hello"); +---- + +And in XML DSL: + +[source,xml] +---- +<route> + <from uri="activemq:cheese"/> + <transform> + <simple>Hello ${body}</simple> + </transform> + <to uri="activemq:wine"/> +</route> +---- === Message Translator with Bean diff --git a/core/camel-core-engine/src/main/docs/modules/eips/pages/transform-eip.adoc b/core/camel-core-engine/src/main/docs/modules/eips/pages/transform-eip.adoc index 6dcc79e..6d6b2a8 100644 --- a/core/camel-core-engine/src/main/docs/modules/eips/pages/transform-eip.adoc +++ b/core/camel-core-engine/src/main/docs/modules/eips/pages/transform-eip.adoc @@ -5,12 +5,55 @@ :since: :supportlevel: Stable -See below for details +Camel supports the +http://www.enterpriseintegrationpatterns.com/MessageTranslator.html[Message +Translator] from the xref:enterprise-integration-patterns.adoc[EIP +patterns]. -* xref:message-translator.adoc[Message Translator] +image::eip/MessageTranslator.gif[image] + +The Message Translator can be done in different ways in Camel: + +* Using Transform EIP in the DSL +* Calling a xref:latest@manual:ROOT:processor.adoc[Processor] or xref:latest@manual:ROOT:bean-integration.adoc[bean] +to perform the transformation +* Using template-based xref:components::index.adoc[Components], with the template being the source for how the message is translated +* Messages can also be transformed using xref:latest@manual:ROOT:data-format.adoc[Data Format] +to marshal and unmarshal messages in different encodings. + +This page is documenting the first approach by using Transform EIP. == Options // eip options: START include::partial$eip-options.adoc[] // eip options: END + +=== Using Transform EIP + +You can use a xref:transform-eip.adoc[Transform] which uses an +xref:latest@manual:ROOT:expression.adoc[Expression] to do the transformation: + +In the example below we prepend Hello to the message body using the +xref:components:languages:simple-language.adoc[Simple] language: + +[source,java] +---- +from("direct:cheese") + .setBody(simple("Hello ${body}")) + .to("log:hello"); +---- + +And in XML DSL: + +[source,xml] +---- +<route> + <from uri="activemq:cheese"/> + <transform> + <simple>Hello ${body}</simple> + </transform> + <to uri="activemq:wine"/> +</route> +---- +