Skip to content

Commit

Permalink
Add factory method on builder for max+transientErrors(true)
Browse files Browse the repository at this point in the history
  • Loading branch information
simonbasle committed Mar 16, 2020
1 parent 9956372 commit c7c97f3
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions reactor-core/src/main/java/reactor/util/retry/Retry.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,21 @@ public static Builder max(long max) {
return new Builder(false, max, t -> true, false, Duration.ZERO, MAX_BACKOFF, 0d, null);
}

/**
* A {@link Builder} preconfigured for a simple strategy with maximum number of retry attempts over
* subsequent transient errors. An {@link org.reactivestreams.Subscriber#onNext(Object)} between
* errors resets the counter (see {@link Builder#transientErrors(boolean)}).
*
* @param maxInARow the maximum number of retry attempts to allow in a row, reset by successful onNext
* @return the builder for further configuration
* @see Builder#maxAttempts(long)
* @see Builder#transientErrors(boolean)
*/
public static Builder maxInARow(long maxInARow) {
return new Builder(false, maxInARow, t -> true, true, Duration.ZERO, MAX_BACKOFF, 0d,null,
NO_OP_CONSUMER, NO_OP_CONSUMER, NO_OP_BIFUNCTION, NO_OP_BIFUNCTION);
}

/**
* A builder for a retry strategy with fine grained options.
* <p>
Expand Down

0 comments on commit c7c97f3

Please sign in to comment.