Class RetryTemplateBuilder

java.lang.Object
org.springframework.retry.support.RetryTemplateBuilder

public class RetryTemplateBuilder extends Object
Builder that provides a fluent API to configure new instances of RetryTemplate.

By default, the builder configures a BinaryExceptionClassifier that acts upon Exception and its subclasses without traversing causes, a NoBackOffPolicy and a MaxAttemptsRetryPolicy that attempts actions MaxAttemptsRetryPolicy.DEFAULT_MAX_ATTEMPTS times.

The builder is not thread-safe.

Example usage:


 RetryTemplate.builder()
      .maxAttempts(10)
      .exponentialBackoff(100, 2, 10000)
      .retryOn(IOException.class)
      .traversingCauses()
      .build();

 RetryTemplate.builder()
      .fixedBackoff(10)
      .withinMillis(3000)
      .build();

 RetryTemplate.builder()
      .infiniteRetry()
      .retryOn(IOException.class)
      .uniformRandomBackoff(1000, 3000)
      .build();
 
Since:
1.3
Author:
Aleksandr Shamukov, Artem Bilan, Kim In Hoi, Andreas Ahlenstorf, Morulai Planinski, Tobias Soloschenko