Interface RetryInterceptor.Listener

Enclosing class:
RetryInterceptor

public static interface RetryInterceptor.Listener
A listener for RetryInterceptor events. Useful for logging, metrics collection, and monitoring retry behavior.
  • Method Details

    • onFirstAttempt

      default void onFirstAttempt(HttpRequest request)
      Called when the interceptor is about to send the request for the first time.
    • onRetry

      default void onRetry(RetryInterceptor.Context<?> context, HttpRequest nextRequest, Duration delay)
      Called when the interceptor is about to retry a request. The given context specifies the retryable state. The given request and delay specify the next request to send (after any request modification) and how long to wait before sending it, respectively.
    • onComplete

      default void onComplete(RetryInterceptor.Context<?> context)
      Called when the interceptor is about to return the given state as-is because no retry condition matches.
    • onExhaustion

      default void onExhaustion(RetryInterceptor.Context<?> context)
      Called when the interceptor exhausts allowed retry attempts. The given context's RetryInterceptor.Context.retryCount() equals the specified RetryInterceptor.Builder.maxRetries(int).