SAP Cloud Platform Integration- How to capture interface run count in header using Message Monitoring Using oAuth authentication.
This blog post explains, how to capture successful/error run count of the interface in header of the file.
In some scenarios, we need to capture the successful or failed status of an interface and send it to any downstream applications. So this blog post will explain the simplest way to implement it.
Below is the simple iflow shown in this blog and this may varies based on the requirement:
This is the overall iflow looks like and this could be called as sub flow in any of the interface to capture the status.
Use OData adapter which support the “MessageProcessingLog” resource path.
Under connection tab use Oauth credentials or client certificate. Basic authentication will also work however the user and password will be changing based on the environment so recommended option is to use a common user and password like (Oauth credentials or client certificate)
In Address use your tenant url followed by /api/v1 like below
Deploy the oauth token url , client Id and secret id from the cockpit in Manage Security Material
Under processing tab follow the below steps
- Operation Details: Get
- Resource path: MessageProcessingLogs – Which will fetch all the status from the Monitor
- Query Option: In query option Select the required field (OriginComponentName, LocalComponentName ,CustomStatus, ,Status,IntegrationFlowName,LogEnd, LogStart , &$filter=(Status eq ‘COMPLETED’ or ‘Failed’) and (IntegrationFlowName eq ‘Your iflow name- Here’)
- And any logstart and logend date and time could also be used in the filter criteria to capture the status depends on any particular time period
Use content modifier to capture the count by using simple expression “Count” and the xpath of the status as shown below
And call this property in the end of the iflow
This is one of the simplest ways of capturing run count of an iflow and this could be used or customized based on your requirements. And this blog post helps ,who are not, much familiar with scripts.