From ca62cc6bf76d038055fd364fb409ebde3d36b1dd Mon Sep 17 00:00:00 2001 From: puncleV Date: Thu, 7 Nov 2024 16:13:04 +0200 Subject: [PATCH] (docs) update readme with usage for `RetryException` --- riptide-failsafe/README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/riptide-failsafe/README.md b/riptide-failsafe/README.md index 187e0d26..ee08bc4f 100644 --- a/riptide-failsafe/README.md +++ b/riptide-failsafe/README.md @@ -77,6 +77,23 @@ RetryPolicy.builder() .build(); ``` +By default, you can use RetryException in your routes to retry the request: + +```java +retryClient.get() + .dispatch( + series(), on(CLIENT_ERROR).call( + response -> { + if (specificCondition(response)) { + throw new RetryException(response); // we will retry this one + } else { + throw new AnyOtherException(response); // we wont retry this one + } + } + ) + ).join() +``` + Failsafe supports dynamically computed delays using a custom function. Riptide: Failsafe offers implementations that understand: