Interface RetryConfig

All Superinterfaces:
Prototype.Api, Prototype.Factory<Retry>
All Known Implementing Classes:
RetryConfig.BuilderBase.RetryConfigImpl

public interface RetryConfig extends Prototype.Api
Retry configuration bean.
See Also:
  • Field Details

    • DEFAULT_CALLS

      static final int DEFAULT_CALLS
      Default calls to make.
      See Also:
    • DEFAULT_DELAY

      static final Duration DEFAULT_DELAY
      Default delay between retries.
      See Also:
    • DEFAULT_OVERALL_TIMEOUT

      static final Duration DEFAULT_OVERALL_TIMEOUT
      Default overall timeout.
      See Also:
  • Method Details

    • builder

      static RetryConfig.Builder builder()
      Create a new fluent API builder to customize configuration.
      Returns:
      a new builder
    • builder

      static RetryConfig.Builder builder(RetryConfig instance)
      Create a new fluent API builder from an existing instance.
      Parameters:
      instance - an existing instance used as a base for the builder
      Returns:
      a builder based on an instance
    • create

      static RetryConfig create(Config config)
      Create a new instance from configuration.
      Parameters:
      config - used to configure the new instance
      Returns:
      a new instance configured from configuration
    • create

      static RetryConfig create()
      Create a new instance with default values.
      Returns:
      a new instance
    • name

      Optional<String> name()
      Name for debugging, error reporting, monitoring.
      Returns:
      name of this retry
    • calls

      int calls()
      Number of calls (first try + retries).
      Returns:
      number of desired calls, must be 1 (means no retries) or higher.
    • delay

      Duration delay()
      Base delay between try and retry. Defaults to 200 ms.
      Returns:
      delay between retries (combines with retry policy)
    • delayFactor

      double delayFactor()
      Delay retry policy factor. If unspecified (value of -1), Jitter retry policy would be used, unless jitter is also unspecified.

      Default when Retry.DelayingRetryPolicy is used is 2.

      Returns:
      delay factor for delaying retry policy
    • jitter

      Duration jitter()
      Jitter for Retry.JitterRetryPolicy. If unspecified (value of -1), delaying retry policy is used. If both this value, and delayFactor() are specified, delaying retry policy would be used.
      Returns:
      jitter
    • overallTimeout

      Duration overallTimeout()
      Overall timeout of all retries combined.
      Returns:
      overall timeout
    • skipOn

      Set<Class<? extends Throwable>> skipOn()
      These throwables will not be considered retriable, all other will.
      Returns:
      throwable classes to skip retries
      See Also:
    • applyOn

      Set<Class<? extends Throwable>> applyOn()
      These throwables will be considered retriable.
      Returns:
      throwable classes to trigger retries
      See Also:
    • retryPolicy

      Optional<Retry.RetryPolicy> retryPolicy()
      Explicitly configured retry policy.
      Returns:
      retry policy