Previous – Claim Check | Index | Next – Canonical Data Model
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.
Integration Flow
Place an Order
The integration flow exposes the Normalizer as HTTPS service using
HTTPS Sender Adapter. The Normalizer consists of a
Router and two
Message Mappings.
Here's the configuration of the Router:
Order |
Route Name |
Condition Expression |
Default Route |
1 |
Format A |
boolean(/Order/Id) |
Unchecked |
2 |
Format B |
boolean(/Order/OrderID) |
Unchecked |
3 |
Unknown Format |
|
Checked |
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.
Conclusion
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.
References/Further Readings
Hope this helps,
Bala
Previous – Claim Check | Index | Next – Canonical Data Model