Technical Articles
Cloud Integration OData APIs – Way To Retrieve Persist Messages From Cloud Tenant
SAP CPI provides various ways for message persistence – “Persist” message is one of them. Using this option, developers have control to store a payload at a specific point in the process. Further, this payload can be used as a reference point for any analysis. A simple use case could be – “business process validation” – where business wants some dependent information to meet compliance.
Some facts about Persist step:
-
Shares the same tenant DB as the data store (Details)
-
To access the contents – Use Cloud Integration OData API
-
Message store can be accessed only after execution of the i-flow that writes the entry
-
Life of message is 30 days, after that it will be deleted automatically
API Details:
Scenario for understanding the functionality:
- Send an HTTP request (ProductID)
- Store the request payload using “Persist Message” (Before Message)
- Fetch “Product Review” through OData API based on requested ProductID
- Store the “Product Review” response payload using “Persist Message” (After Message)
Integration Flow Design
Integration Flow Design
OData Channel Configuration
Address: https://refapp-espm-ui-cf.cfapps.eu10.hana.ondemand.com/espm-cloud-web/espm.svc
Resource Path: CustomerReviews
Query: $select=Comment,FirstName,LastName,ProductId,Rating,CustomerReviewId,CreationDate&$filter=ProductId eq ‘${property.Productid}’
OData Channel Configuration
HTTP Request – POSTMAN
Sending ProductId through HTTP Request
HTTP Response – POSTMAN
Receiving Customer Review through HTTP Response
Getting Message ID
Message ID
Cloud Integration OData Call
Pass copied Message ID to “MessageProcessingLogs” to fetch “MessageStoreEntries”
https://<Cloud Integration host>/api/v1/MessageProcessingLogs(‘<Message ID>’)/MessageStoreEntries
https://4cb3e2d7trial.it-cpitrial04.cfapps.eu10-002.hana.ondemand.com/api/v1/MessageProcessingLogs(‘AGGSC3AkbkVgwR2jiIGqmnbODLgE’)/MessageStoreEntries
Get MessageProcessingLogs based on Message ID
Pass copied Id to “MessageStoreEntries” to fetch the payload
https://<Cloud Integration host>/api/v1/MessageStoreEntries(‘<Message Stored Entries Id>’)/$value
https://4cb3e2d7trial.it-cpitrial04.cfapps.eu10-002.hana.ondemand.com:443/api/v1/MessageStoreEntries(‘3463623365326437747269616c2f6d65737361676573746f72652f6d6573736167652f414747534333416b626b56677752326a694947716d6e624f444c67452f50726f647563744265666f72652f33653230636638342d323337652d346332642d623866322d353239363534373839333432’)/$value
Persist payload from 1st MessageStoreId (ProductBefore)
https://4cb3e2d7trial.it-cpitrial04.cfapps.eu10-002.hana.ondemand.com:443/api/v1/MessageStoreEntries(‘3463623365326437747269616c2f6d65737361676573746f72652f6d6573736167652f414747534333416b626b56677752326a694947716d6e624f444c67452f52657669657741667465722f64653462663034322d363935322d343761392d386131642d336361396632303032656161’)/$value
Persist payload from 2nd MessageStoreId (ReviewAfter)
Now, it is your turn to design your business use case by implementing message persistence – through “Persist”; access the stored message content through Cloud Integration OData API & feel the power of API Business Hub. Please do share your use case as well 😊
Any question or feedback will be appreciated!
Nice blog! Kris Chau
and I have a question, does Persist step store Exchange property and Headers value too?
Regards,
Naveen