cloud-sdk-js icon indicating copy to clipboard operation
cloud-sdk-js copied to clipboard

Add Resilience configuration options

Open mtamagnini opened this issue 3 years ago • 9 comments

Is your feature request related to a problem? Please describe.

When dealing with Destination services, it is quite often necessary to re-send an API call against a given endpoint. In our case, we (i.e. SAP Graph Team) have the need of sending "hundreds" - and potentially "thousands" - of requests against Destination service. To reach such behaviour, today a developer needs to implement it by his/her-self with an additional layer of custom code (and it should not be build on every SDK-based project again and again...).

Describe the solution you'd like

As already in place in Java version of Cloud SDK (see ResilienceConfiguration.RetryConfiguration), it would be great to add ResilienceConfigurationOptions - in particular, the retry config - also to JS/TS version of CloudSDK, enabling (at least) the followings:

  • option-set from Java version;
  • non linear delay in the resilience;
  • option for switching on in getDestination, executeHttp, execute and fetchDestination;
  • possibility to add an interceptor's callback method.

Impact / Priority

Affected development phase: Product Release

Impact: Impaired and feature fix Blocked

Timeline: Upcoming Product release.

Additional context Already had a short discussion with @FrankEssenberger.

mtamagnini avatar Nov 30 '21 09:11 mtamagnini

This could be a quick win to include it: https://www.npmjs.com/package/axios-retry

FrankEssenberger avatar Nov 30 '21 09:11 FrankEssenberger

Hey, @mtamagnini

We use Resilience4j in Java which simplifies things a lot. When starting the JS SDK there was no good library to integrate. We might reconsider it in 2022 but I doubt we can release anything soon. That's why I'd recommend using available libraries together with SDK. Frank already suggested axiso-retry. Here is a couple of the most popular libs:

  • https://genesys.github.io/mollitia/
  • https://github.com/connor4312/cockatiel

Please, share the results of your experiments, or let's have a call when you gain some experience to discuss potential convenience options.

artemkovalyov avatar Dec 14 '21 14:12 artemkovalyov

My teammates also mentioned that circuit breaker is integrated in the SDK with https://github.com/nodeshift/opossum Sadly there's no developer documentation on the portal, you'll have to take a look in the API docs. cc @marikaner

artemkovalyov avatar Dec 14 '21 16:12 artemkovalyov

Here a second use asked about resilience: https://answers.sap.com/questions/13572567/cap-transient-error-handling.html# Potentially we should increase priority on this.

FrankEssenberger avatar Jan 31 '22 08:01 FrankEssenberger

So after a long time there is some progress and we created a ADR to implement a resilience on a flexible middle ware approach: https://github.com/SAP/cloud-sdk-js/pull/2320 as graph team colleagues @mtamagnini @Johannes-Schneider could you perhaps give quick feedback if the ADR goes in the right direction?

FrankEssenberger avatar Apr 12 '22 15:04 FrankEssenberger

Hey @FrankEssenberger,

Did you actually mean to ping me in this issue?

Johannes-Schneider avatar Apr 21 '22 06:04 Johannes-Schneider

No I wanted to ping @johenning from the sap graph team. Sorry.

FrankEssenberger avatar Apr 21 '22 06:04 FrankEssenberger

@FrankEssenberger I wasn't super involved with this topic, but as far as I can tell the ADR looks good 👍

johenning avatar Apr 27 '22 07:04 johenning

Thanks for the feedback. We tried to make it possible to also bring a custom solution in case the options are not flexible enough.

FrankEssenberger avatar Apr 27 '22 07:04 FrankEssenberger

Hi @mtamagnini

I know this issue has been open for a long time. Wanted to let you know that for version 3 of the sdk we are working on a generic middleware/resilience approach that also includes retry. It is implemented in this pr but not yet released. If nothing unexpected happens this should be part of v3 of the sdk. I can't promise a specific release date.

Hope this helps, Florian

fwilhe avatar Dec 21 '22 08:12 fwilhe