Skip to content

Commit

Permalink
add doc about retry middleware usage
Browse files Browse the repository at this point in the history
  • Loading branch information
jenschude committed Oct 25, 2023
1 parent 0733158 commit ff9b7c8
Showing 1 changed file with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,27 @@
import dev.failsafe.spi.Scheduler;

/**
* Middleware for retrying of a requests upon configured response status codes and/or exceptions
* <h2>Retry failed requests</h2>
*
* <p>Middleware for retrying of a requests upon configured response status codes and/or exceptions</p>
*
* <h3>Retrying on HTTP status codes</h3>
*
* <p><pre><code class='java'>{@code
* ApiRootBuilder.of()
* ...
* .withRetryMiddleware(3, Arrays.asList(HttpStatusCode.SERVICE_UNAVAILABLE_503, HttpStatusCode.INTERNAL_SERVER_ERROR_500))
* }</code></pre>
* </p>
*
* <h3>Retrying specific exceptions</h3>
*
* <p><pre><code class='java'>{@code
* ApiRootBuilder.of()
* ...
* .addMiddleware(RetryRequestMiddleware.of(3, emptyList(), singletonList(JsonException.class)))
* }</code></pre>
* </p>
*/
public interface RetryRequestMiddleware extends Middleware {
int DEFAULT_MAX_DELAY = 60000;
Expand Down

0 comments on commit ff9b7c8

Please sign in to comment.