Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
AmanVarshney
Product and Topic Expert
Product and Topic Expert
Hello Fellow Learners,

In continuation to my hustle around retrying messages with a configurable wait time and max iteration for http calls.

I am quite aware of Retry patterns detailed in the official guidelines SAP Help : Apply the Retry Pattern, further the new inbuilt feature to retry http calls SAP Integration Suite – Inbuilt Retry option for HTTP Receiver Adapter fulfils the purpose completely but still I am willing to lay down this approach for the general usability, if the above approaches are not achievable due any reasons.

In December 2020 I raised this Question : Possibility to retry an SAP CPI Iflow request-reply step in case of http error in the community and received valuable suggestions to use JMS queues/datastore and as of current day we have SAP Event Mesh and SAP Advanced Event Mesh(with advanced features you can find here).

But somehow I felt sticking to the Iflow approach and strived to find logical design specific solution only.

Last year I implemented a simple solution, looking genuine and felt worth sharing. The intention of this solution is to retry the http trigger in case of 5XX http errors (temporary server related glitches like 500 etc.). However please note in the below example I have tried to achieve the result through another deployed iflow's http endpoint, hence worked with 404 for demonstration purpose.

Problem Statement:
Resend the message through HTTP Receiver for a fixed number of retries after receiving Response code as 500 with a pause, say after 20 secs.

Design Solution:


Design Solution


Explanation: 

  1. Separate the http request reply call from the Main process [2] in a new local sub-process [3]

  2. Save http request payload in property as initialPayload and the configured waitTimeInSec before calling the looping sub process

  3. Run this local process[3] in loop until the http response code is different than 404 till maximum 5 iteration, post that the loop ends (suitable option can be chosen in Action when Max iteration is reached).

  4. The max Number of Iteration is fixed here as 5 (can be any positive integer as this field entry do not support externalisation/variable)

  5. Add a router to validate the exceeding condition and route to error end in case it exceeds the max iteration count

  6. Any error in the main process through error end/any other exception will in turn run the Exception sub process and attach MPL through Groovy

  7. The local integration process [3] has 2 routers routing by conditional check for 1st call, if not then conditional check for 404 to follow the reset,sleep and retry lane. In case of any other error the local integration process [3] ends, loop breaks and next steps of the main process [2] is executed
    -----------------------------------------------------------------------------------------------------------------------------

  8. In the HTTP receiver adapter configuration. The Throw Exception on Failure option should be unchecked to achieve this retry approach.

  9. In the main process [2] the router does a conditional check of the httpresponsecode, here we have the possibility to handle each error separately and apply right error handling mechanism as per SAP Help : Handle Errors Gracefully. It is also possible that the flow is extended to push the payload to retry queues for later retries.


 

The implementation of this approach is likely to vary as per your individual use case.

Hence I would love to hear back from the community on this approach.
6 Comments
Bais
Participant
0 Kudos
Hi thank you for your good work, I've notice you are using Escalated end, do you know when Integration Suite will manage a nested error escalations likes a normal java try/catch system?
maheswarareddykonda
Active Contributor
Well explained, however sap has recently released new update on http receiver adapter to reprocess the message if there is any issues with connection

Also this solution works where cpi adapter has "Throw Exception on Failure" option, I think this option not available for other adapters

Regarding sleep option, it's not recommend for transactional or high frequency interfaces

 

Anyway it's nice to on retry handling and can be used few areas
AmanVarshney
Product and Topic Expert
Product and Topic Expert
0 Kudos
Hello maheswarareddykonda,

As I mentioned in the beginning of the blog, its just an attempt to achieve retry option alongside other possible options for which I have provided the useful links to refer.

I would say with multiple options (cloud + on-premise) in picture now it can be a useful approach for consumers not still having the standard retry options available or want to utilize queue resources wisely.

Regarding the sleep I would say its a calculated decision and completely depends on the use case - as it allows retry with iteration limitation and configurable time entity (starting in millisecs).
AmanVarshney
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello federico.bellizia ,


Thanks for your question.



In the scope of this POC my intention was to easily identify the messages for which the max retry has been exhausted hence I used Escalation end. This part is optional and can be replaced by any suitable extensions, or traditional retry approaches like pushing to JMS/datastore.



The second part of your question is not clear to me, if its regarding expectancy for any standard functionality to auto pick the escalated message, I am not informed of any such roadmap. Please feel free to raise this as an SAP Customer Influence topic for our development team to acknowledge.

Bais
Participant
0 Kudos
I'm a SAP influencer before that site was created 🙂 I sent 62 requests on 2017 (directly to project leader and developer leader in India) 🙂 and you can find me there with same name and surname 🙂

The question is simple, we notice there are some problems with escalation managing in Integration Suite, we asked for fix problems (by tickets, influence, here) and improve managing.

Did you ever try to manager a nested escalation between 2 sub processes?
sayed42
Explorer
0 Kudos

Hello Aman,

Thanks for such a wonderful blog, Can you please share this .iflw file?

It would be a great help.

Thanks,

Sufiyan.