Skip to Content
Technical Articles

SAP CPI : Retrieve persisted messages through iFlow by consuming API

Persist in CPI helps you to store Message permanently. Information such as message GUID, time stamp, and payload are stored at runtime for the messages at the persistence process steps.

There is no UI from SAP to monitor persisted message . You may go through this link where you can monitor persisted messages.

WHINT MessageStore Viewer for SAP CPI

The other way to fetch persisted data which I found is to consume API to call Message store details. Lets get started with the design and see the result.

1st iFlow : Persists the data

Sender Adapter – Normal HTTPS

1st Persist – Stores the triggered input data[in my case its XML data]

Mapping – Concatenates FirstName and LastName and the result will be FullName

2nd Persist – Stores Mapping output

Deploy the flow and make a note of Message ID

 

2nd iFlow : Retrieves persisted data from MessageStore

Content Modifier[MessageID] – Set Basic Auth credentials of your tenant in header and Message ID of the previous iFlow in property

Request-Reply : Call OData API- /MessageProcessingLogs(‘{MessageGuid}’)/MessageStoreEntries to fetch MessageStore details which will return response in XML format.

XML response :

   Next , I’ve used XML to JSON Converter, Groovy Script, Iterating Splitter and one more Groovy Script only to extract MessageStoreID captured in the above snip to pass on to another API call to fetch persisted data. You may design your convenient way to extract only the MessageStoreID from API call response.

Request-Reply : Call OData API /MessageStoreEntries(‘{MessageStoreEntryId}’)/$value to fetch persisted data.

Finally, I am sending fetched data to my E-mai for reference.

Output : Persist-BeforeMapping

Persist-AfterMapping

 

Likewise, you can try out other API operations and enjoy persisting the messages 🙂

 

Was it helpful?Please do let me know your thoughts.

 

!!!!!HaPpY LeArNiNg!!!!!

 

Sathya

1 Comment
You must be Logged on to comment or reply to a post.