Skip to Content
Technical Articles
Author's profile photo Kris Chau

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:

  1. Send an HTTP request (ProductID)
  2. Store the request payload using “Persist Message” (Before Message)
  3. Fetch “Product Review” through OData API based on requested ProductID
  4. Store the “Product Review” response payload using “Persist Message” (After Message)

 

Integration Flow Design

Integration%20Flow%20Design

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%20Channel%20Configuration

OData Channel Configuration

 

HTTP Request – POSTMAN 

Sending%20ProductId%20through%20HTTP%20Request

Sending ProductId through HTTP Request

 

HTTP Response – POSTMAN 

Receiving%20Customer%20Review%20through%20HTTP%20Response

Receiving Customer Review through HTTP Response

 

Getting Message ID

Message%20ID

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%20MessageProcessingLogs%20based%20on%20Message%20ID

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%20payload%20from%201st%20MessageStoreId%20%28ProductBefore%29

Persist payload from 1st MessageStoreId (ProductBefore)

 

https://4cb3e2d7trial.it-cpitrial04.cfapps.eu10-002.hana.ondemand.com:443/api/v1/MessageStoreEntries(‘3463623365326437747269616c2f6d65737361676573746f72652f6d6573736167652f414747534333416b626b56677752326a694947716d6e624f444c67452f52657669657741667465722f64653462663034322d363935322d343761392d386131642d336361396632303032656161’)/$value

Persist%20payload%20from%202nd%20MessageStoreId%20%28ReviewAfter%29

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!

 

 

Assigned Tags

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