cloud-sdk-js
cloud-sdk-js copied to clipboard
Add Resilience configuration options
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,executeandfetchDestination; - 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.
This could be a quick win to include it: https://www.npmjs.com/package/axios-retry
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.
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
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.
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?
Hey @FrankEssenberger,
Did you actually mean to ping me in this issue?
No I wanted to ping @johenning from the sap graph team. Sorry.
@FrankEssenberger I wasn't super involved with this topic, but as far as I can tell the ADR looks good 👍
Thanks for the feedback. We tried to make it possible to also bring a custom solution in case the options are not flexible enough.
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