Technical Articles
CPI Extensibility – Enhanced UDMS
Hi Community,
This is Part 2 of this blog series. Part1 can be found here.
Introduction:
In this blog, I am going to discuss an architectural solution for achieving user defined message search (UDMS) in SAP cloud platform integration (CPI). UDMS is one of the aspects of integration monitoring where you can search messages through business data. UDMS can be configured out of the box in CPI using SAP_ApplicationID. Please find below blog form Eng Swee Yeoh for details on this and many other helpful tips.
https://blogs.sap.com/2019/06/14/eng-swees-tips-for-cpi-development/
If there is a need for enhanced UDMS where integration messages need to be searched with multiple business data elements, below is one of the approach we can take to build a custom CPI extension using different services of SAP Cloud Platform (SCP).
Architecture:
Integration Flow Overview:
The integration flow below is a simple integration scenario explained in SAP tutorial below.
https://developers.sap.com/mission.cp-integration-flow-logistics.html
I will explain the details of enhanced UDMS (steps 1 – 5 highlighted in the diagram below), while other parts of the integration flow is quite standard and explained in detail in the tutorial.
Step 1:
Using content modifier step, get the interface business data (here CustomerName, OrderID, OrderDate), MessageId, and CorrelationId as exchange properties as shown below:
Step 2:
Using sequential multicast step, send the first message to UDMS Receiver and the second message to the actual Receiver.
Step 3:
Using content modifier step, create message body JSON message payload for sending UDMS data to UDMS receiver. This payload will have ScenarioId, MessageId, CorrelationId, an array of UDMS key and values as shown below. The MessageID, CorrelationID and UDMS values are populated from the exchange properties from Step1.
Step 4:
Using AMQP Adapter, Send the UDMS payload data (shown above) to SCP Enterprise Messaging Queue.
Below blog from Dries Van Vaerenbergh explains configuring AMQP adapter for SCP Enterprise Messaging service.
For more details on AMQP Adapter functionality in general, refer to the below blog from Mandy Krimmel
Note: A Queue should be created in the SCP Enterprise Messaging instance as below.
Step 5:
Send the Payload to actual receiver. In this example, Message Payload is sent to an email receiver.
Step 6:
Custom CPI Extension:
The CPI custom extension picks the messages from enterprise messaging UDMS Queue and save them in SCP HANA database. The extension application enables to search messages based on UDMS by getting message processing logs from CPI API and UDMS data from SCP HANA database.
The CPI API for getting message processing logs is below
https://<cpihost>/api/v1/MessageProcessingLogs(‘<MessageID>’)?$format=json
Testing:
Running three test payloads with following Business Data
OrderId: 4500020001
CustomerName: Customer10
OrderDate: 07.10.2020
OrderId: 4500020002
CustomerName: Customer10
OrderDate: 07.10.2020
OrderId: 4500020003
CustomerName: Customer11
OrderDate: 07.10.2020
All messages sent to actual mail receiver like below:
The UDMS search looks like below:
Conclusion:
The blog should provide an architecture solution that can be implemented for enhanced UDMS requirements in CPI. This shows how CPI functionality can be extended using services of SCP. There can be other ways to achieve similar requirement. I would love to hear your feedback, comments and suggestions.
Thank you and have a great day..
nice article.
Thank you Varun..
Best Regards,
Venu