This week, we’ll study a Message Transformation pattern known as Normalizer.
When do I use this pattern?
Normalizer pattern is used to translate/map objects in different format into a common format. Here, the different objects represent a single entity. For example, an order coming from Business Partner A can have a different format to an order sent by Business Partner B. In this case, the message from both business partners represents an order. So both these orders can be translated/mapped to a common format of order for processing in the middleware.
Normalizer in CPI
In CPI, we can use the Message Translator pattern to achieve a single transformation from a given format to target format. If we have Message Translators for each format, then we will be able to “normalize” the format. We also need a Message Router to route the incoming message to correct Message Translator.
Here’s the configuration of the Router:
|Order||Route Name||Condition Expression||Default Route|
In the Router, we are determining the data format based on the existence of /Order/Id node or the existence of /Order/OrderID node. Based on the identified format, appropriate message mapping is executed.
The Normalizer pattern refers to translating an entity from multiple formats into a common format. In CPI, a combination of Message Router and Message Translators can be used to implement a Normalizer.
- Normalizer Pattern in Enterprise Integration Patterns
- CPI Components
Hope this helps,