You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We've been using resilience4j in our project for a while, and now we're facing some issues when trying to migrate our code to 2.0.2 version that we can't seem to figure out.
// Decorate the invocation of the HelloWorldService
CheckedFunction0 retryableSupplier = Retry
.decorateCheckedSupplier(retry, helloWorldService::sayHelloWorld);
// When I invoke the function
Try result = Try.of(retryableSupplier)
.recover((throwable) -> "Hello world from recovery function");
Retry#decorateCheckedSupplier now returns CheckerSupplier, not CheckedFunction0, and CheckedSupplier does not extend Supplier, so it cannot be passed to Try#of or Try#ofSupplier
Documentation here in gitlab has the following example for retries, again using vavr's Try class, but in this case we wouldn't be able to throw a checked exception in the Supplier:
// Decorate your call with automatic retry
decoratedSupplier = Retry
.decorateSupplier(retry, decoratedSupplier);
// Use of Vavr's Try to
// execute the decorated supplier and recover from any exception
String result = Try.ofSupplier(decoratedSupplier)
.recover(throwable -> "Hello from Recovery").get();
Has anyone used CheckedSupplier successfully in this scenario?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi,
We've been using resilience4j in our project for a while, and now we're facing some issues when trying to migrate our code to 2.0.2 version that we can't seem to figure out.
https://resilience4j.readme.io/docs/retry#decorate-and-execute-a-functional-interface still has the old code as example (even with v2.0.0 selected), before the vavr dependency has been removed. The code we're having trouble with is essentially the same as this example:
Retry#decorateCheckedSupplier now returns CheckerSupplier, not CheckedFunction0, and CheckedSupplier does not extend Supplier, so it cannot be passed to Try#of or Try#ofSupplier
Documentation here in gitlab has the following example for retries, again using vavr's Try class, but in this case we wouldn't be able to throw a checked exception in the Supplier:
Has anyone used CheckedSupplier successfully in this scenario?
Beta Was this translation helpful? Give feedback.
All reactions