failsafe-lib / failsafe

Fault tolerance and resilience patterns for the JVM
https://failsafe.dev
Apache License 2.0
4.16k stars 295 forks source link

Feature Request: Integrate / add support for Lunar Proxy (backend policy) #376

Open kaplanlior opened 6 months ago

kaplanlior commented 6 months ago

Using FailSafe is a useful solution. In some cases, we'd like to keep the option to adapt / change the policy or its parameters (e.g. number of retries, timeouts) on the fly. That could be for debugging purposes or in need to react to an external event. With failsafe, these changes require a code update and a deployment of the file.

We'd like to suggest an integration from FailSafe to Lunar Proxy in order to allow the developer to delegate some decisions to Lunar or to allow Lunar to add on top of the resilience measures defined by FailSafe - e.g. changing the fallback values without code redeployment.

This can be done with Lunar, an API egress proxy - https://github.com/TheLunarCompany/lunar (an Open Source project under MIT license)

We saw a case where a similar change was required for multiple uses / deployments of code that used FailSafe. We'd like to allow the developer to plan (in advance) cases / API calls which leave more flexibility instead of coding the strategy & its parameters.

Also adding as a reference: https://github.com/failsafe-lib/failsafe/issues/320 (the option for a backend was mentioned there)

Tembrel commented 6 months ago

Some aspects of Failsafe policy behavior can already be computed/enforced on the fly. Some examples:

More substantial changes to policy behavior from on-the-fly changes run the risk of being hard to define, especially under asynchronous execution.

Do you have a concrete realistic example of something that can't accomplished with the present state of Failsafe Java?