This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push:
new 88d7258 CAMEL-14191: EIP docs - Add links to last EIP patterns and
add new pages if missing content
88d7258 is described below
commit 88d725881fa94d59541ebed1db87f66dc5870e06
Author: Claus Ibsen <[email protected]>
AuthorDate: Wed Nov 20 07:41:16 2019 +0100
CAMEL-14191: EIP docs - Add links to last EIP patterns and add new pages if
missing content
---
.../ROOT/assets/images/eip/NormalizerDetail.gif | Bin 0 -> 8388 bytes
.../pages/enterprise-integration-patterns.adoc | 2 +-
.../user-manual/modules/ROOT/pages/normalizer.adoc | 75 +++++++++++++++++++++
3 files changed, 76 insertions(+), 1 deletion(-)
diff --git
a/docs/user-manual/modules/ROOT/assets/images/eip/NormalizerDetail.gif
b/docs/user-manual/modules/ROOT/assets/images/eip/NormalizerDetail.gif
new file mode 100644
index 0000000..ab7f960
Binary files /dev/null and
b/docs/user-manual/modules/ROOT/assets/images/eip/NormalizerDetail.gif differ
diff --git
a/docs/user-manual/modules/ROOT/pages/enterprise-integration-patterns.adoc
b/docs/user-manual/modules/ROOT/pages/enterprise-integration-patterns.adoc
index 393abf5..776988d 100644
--- a/docs/user-manual/modules/ROOT/pages/enterprise-integration-patterns.adoc
+++ b/docs/user-manual/modules/ROOT/pages/enterprise-integration-patterns.adoc
@@ -201,7 +201,7 @@ of message sent across the system without sacrificing
information
content?
a|image::eip/NormalizerIcon.gif[image]
-|Normalizer |How do you process messages that are
+|xref:normalizer.adoc[Normalizer] |How do you process messages that are
semantically equivalent, but arrive in a different format?
|
diff --git a/docs/user-manual/modules/ROOT/pages/normalizer.adoc
b/docs/user-manual/modules/ROOT/pages/normalizer.adoc
new file mode 100644
index 0000000..abf9333
--- /dev/null
+++ b/docs/user-manual/modules/ROOT/pages/normalizer.adoc
@@ -0,0 +1,75 @@
+[[Normalizer]]
+= Normalizer
+
+Camel supports the
+https://www.enterpriseintegrationpatterns.com/patterns/messaging/Normalizer.html[Normalizer]
+from the xref:enterprise-integration-patterns.adoc[EIP patterns] book.
+
+The normalizer pattern is used to process messages that are semantically
equivalent,
+but arrive in different formats. The normalizer transforms the incoming
messages into a common format.
+
+image::eip/NormalizerDetail.gif[image]
+
+In Apache Camel, you can implement the normalizer pattern by combining a
xref:content-based-router-eip.adoc[Content Based Router],
+which detects the incoming message's format, with a collection of different
xref:message-translator.adoc[Message Translator]'s,
+which transform the different incoming formats into a common format.
+
+== Sample
+
+This example shows a Message Normalizer that converts two types of XML
messages into a common format.
+Messages in this common format are then filtered.
+
+[source,java]
+----
+// we need to normalize two types of incoming messages
+from("direct:start")
+ .choice()
+
.when().xpath("/employee").to("bean:normalizer?method=employeeToPerson")
+
.when().xpath("/customer").to("bean:normalizer?method=customerToPerson")
+ .end()
+ .to("mock:result");
+----
+
+In this case we're using a Java bean as the normalizer. The class looks like
this
+
+[source,java]
+----
+// Java
+public class MyNormalizer {
+ public void employeeToPerson(Exchange exchange,
@XPath("/employee/name/text()") String name) {
+ exchange.getOut().setBody(createPerson(name));
+ }
+
+ public void customerToPerson(Exchange exchange, @XPath("/customer/@name")
String name) {
+ exchange.getOut().setBody(createPerson(name));
+ }
+
+ private String createPerson(String name) {
+ return "<person name=\" + name + \"/>";
+ }
+}
+----
+
+The same example in the XML DSL
+
+[source,xml]
+----
+<camelContext xmlns="http://camel.apache.org/schema/spring">
+ <route>
+ <from uri="direct:start"/>
+ <choice>
+ <when>
+ <xpath>/employee</xpath>
+ <to uri="bean:normalizer?method=employeeToPerson"/>
+ </when>
+ <when>
+ <xpath>/customer</xpath>
+ <to uri="bean:normalizer?method=customerToPerson"/>
+ </when>
+ </choice>
+ <to uri="mock:result"/>
+ </route>
+</camelContext>
+
+<bean id="normalizer" class="org.apache.camel.processor.MyNormalizer"/>
+----
\ No newline at end of file