Red Hat Training

A Red Hat training course is available for Red Hat Fuse

8.3. Normalizer


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.
In Apache Camel, you can implement the normalizer pattern by combining a content-based router, which detects the incoming message's format, with a collection of different message translators, which transform the different incoming formats into a common format.

Figure 8.3. Normalizer Pattern

Normalizer pattern

Java DSL example

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.
Using the Fluent Builders
// we need to normalize two types of incoming messages
In this case we're using a Java bean as the normalizer. The class looks like this
// Java
public class MyNormalizer {
    public void employeeToPerson(Exchange exchange, @XPath("/employee/name/text()") String name) {

    public void customerToPerson(Exchange exchange, @XPath("/customer/@name") String name) {
    private String createPerson(String name) {
        return "<person name=\"" + name + "\"/>";

XML configuration example

The same example in the XML DSL
<camelContext xmlns="">
    <from uri="direct:start"/>
        <to uri="bean:normalizer?method=employeeToPerson"/>
        <to uri="bean:normalizer?method=customerToPerson"/>
    <to uri="mock:result"/>

<bean id="normalizer" class="org.apache.camel.processor.MyNormalizer"/>