EIPinCPI – Message Store
When do I use this pattern?
Message Store is used to persist the message or parts of it for reporting and analytics purpose. The Message can be stored in the persistence using a Wire Tap or by using a dedicated step.
Message Store in CPI
In CPI, the message can be stored in Message Store using Persist step like so:
This flow starts immediately using the Timer Start Event, then Content Modifier step sets a Header, a Property, and the body of the message. Finally, Persist step will persist the message into the Message Store.
Accessing the Message
The persisted message can be accessed using CPI’s OData API.
Fetch the Message ID
First, let’s run the flow. When the flow is deployed we can view the Message ID in monitoring.
Get the Message Store Entry using the Message ID
Now, I can use the Message ID to fetch the message store entries by running HTTP GET on the URL:
Get the Body of the Message
Get the Headers of the Message
Please note that here the path /Properties does not mean Exchange Properties, the path /Properties stores headers of the message.
If other standard headers for the sender, receiver, message type, application id are populated before persisting, then, using UI5 it will be easy to build reports based on these factors. For example, finding out the number of messages by a given sender of a given message type.
CPI has dedicated step and OData API to access the Message Store. Therefore, a complete 10 out of 10 rating is given.
Conclusion
Message Store is used for storing the message for reporting or analytics purpose.
References/Further Readings
- Message Store Pattern in Enterprise Integration Patterns
- EIPinCPI
- Wire Tap
- CPI Components
- Timer Start Event
- Content Modifier
- Persist