Skip to Content
Technical Articles

EIPinCPI: Document Message

Previous: Command Message | Index | Next: Event Message

This week, we study another variation of Message pattern known as Document Message.

When do I use this pattern?

A Command Message invokes functionality in the target system, whereas, a Document Message is just a message sent to the target system. A Document Message does not tell the receiver system what to do with the message. Examples of the Document Message pattern include a response message from an invoked SOAP operation and sending an Email.

Document Message in CPI

A response message from an invoked SOAP operation

Last week, I commanded W3 Schools to convert 37 ℉ to Celsius. The full response message from W3Schools is:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <soap:Body>
        <FahrenheitToCelsiusResponse xmlns="https://www.w3schools.com/xml/">
            <FahrenheitToCelsiusResult>2.77777777777778</FahrenheitToCelsiusResult>
        </FahrenheitToCelsiusResponse>
    </soap:Body>
</soap:Envelope>

Here, the content between Body element is a document message returned to CPI without telling CPI what to do with it. CPI chose to log that response for monitoring.

Sending an Email

Another example of Document Message is sending an Email. When an email is sent, the email server is free to choose the future of the received message. Some examples of future actions taken by the email server are to assign a tag to the email, move the email to the junk folder, add a line at the top to say “This Email is from External Network. Be careful when clicking on links.”, and so on.

Integration Flow

This is a simple integration flow. It starts as soon as it is deployed and sends the email document.

Steps

Start Immediately

Similar to previous flows in this blog series, this integration flow starts immediately after deployment using the configuration of Run Once in Timer Start.

Mail Adapter

For configuring the Mail Adapter, I’ll refer you to the blog: Gmail Connectivity from CPI.

Here are the configurations I used:

Tab Parameter Value
Connection Address smtp.gmail.com:587
Connection Authentication Plain User/Password
Connection Credential Name Gmail Credentials
Connection From My Email Address
Connection To My Email Address
Connection Subject EIPinCPI
Connection Mail Body Hello, World!

Output

When integration flow is deployed, I receive the email in my Google Account.

Conclusion

Document Message pattern is a variation of Message pattern. Unlike the Command Message pattern, Document Message pattern does not include telling the receiver system what to do with the message.

References/Further Readings

Hope this helps,
Bala

P.S.: Source code should soon be available as an Integration Recipe when my pull request is approved and merged. In the meantime, you can download the iFlow zip from my fork on GitHub.

Previous: Command Message | Index | Next: Event Message

 

Be the first to leave a comment
You must be Logged on to comment or reply to a post.