Class RetryManager

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    public class RetryManager
    extends java.lang.Object
    implements java.io.Closeable
    This class offers advanced client retry behaviors. Specifically enforcing a retry budget and relevant monitoring to avoid retry storm and alert users when the retry threshold is misconfigured or service is degrading.
    • Constructor Summary

      Constructors 
      Constructor Description
      RetryManager​(io.tehuti.metrics.MetricsRepository metricsRepository, java.lang.String metricNamePrefix, long enforcementWindowInMs, double retryBudgetInPercentDecimal)  
      RetryManager​(io.tehuti.metrics.MetricsRepository metricsRepository, java.lang.String metricNamePrefix, long enforcementWindowInMs, double retryBudgetInPercentDecimal, java.time.Clock clock)  
    • Constructor Detail

      • RetryManager

        public RetryManager​(io.tehuti.metrics.MetricsRepository metricsRepository,
                            java.lang.String metricNamePrefix,
                            long enforcementWindowInMs,
                            double retryBudgetInPercentDecimal,
                            java.time.Clock clock)
      • RetryManager

        public RetryManager​(io.tehuti.metrics.MetricsRepository metricsRepository,
                            java.lang.String metricNamePrefix,
                            long enforcementWindowInMs,
                            double retryBudgetInPercentDecimal)
    • Method Detail

      • recordRequest

        public void recordRequest()
      • isRetryAllowed

        public boolean isRetryAllowed()
      • getRetryTokenBucket

        public TokenBucket getRetryTokenBucket()
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable