Technical Articles
SAP CPI : Retrieve persisted messages through iFlow by consuming API(Neo)
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
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
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
Very detailed explanation of Persist. It is recommended method by SAP for storing payload in SAP CPI
Nice blog!!!!!
I am facing an issue after deploying the second IFlow. Error says "404 not found" when it is trying to reach API1 receiver.
Could you please tell me from where to take "Tenant Host". Looks like something wrong i am putting there
Regards,
Nikhil Save
Thanks Nikhil for trying out this approach!!
<Tenant Host> value is taken from the Cloud integration URL
Please do let me know if you could execute it without any issues
Regards,
Sathya
Sathyabhama,
Your explanation was helpful for me.
I would like to say thank you.
Vinícius
Hi Sathyabhama,
I was trying to execute 2nd flow , but am getting statusCode: 401
https://<tenanthost>/api/v1/MessageProcessingLogs(%E2%80%98IDAGBLdkAhz5OZNbGfrPnHLkel5VHg%E2%80%99)/MessageStoreEntries with statusCode: 401
Could you please confirm the http Authorization header created as per this below note:
https://launchpad.support.sap.com/#/notes/0002561389
Thanks & Regards
Vishwakiran
Hi SathyaBhama
Good Explanation. In the scenario, you are manually copying the MessageID and executing the second IFlow. How do you seamlessly pass on the MessageID to the second IFLow to get back the persisted data.
Thank You!
Vijhay D