Class MethodRetryEvent

All Implemented Interfaces:
Serializable

public class MethodRetryEvent extends MethodFailureEvent
Event published for every exception encountered during retryable method invocation. Can be listened to via an ApplicationListener<MethodRetryEvent> bean or an @EventListener(MethodRetryEvent.class) method.
Since:
7.0.3
Author:
Juergen Hoeller
See Also:
  • Constructor Details

    • MethodRetryEvent

      public MethodRetryEvent(MethodInvocation invocation, Throwable failure, boolean retryAborted)
      Create a new event for the given retryable method invocation.
      Parameters:
      invocation - the retryable method invocation
      failure - the exception encountered
      retryAborted - whether the current failure led to the retry execution getting aborted
  • Method Details

    • getFailure

      public Throwable getFailure()
      Return the exception encountered.

      This may be an exception thrown by the method or emitted by the reactive publisher returned from the method, or a terminal exception on retry exhaustion, interruption or timeout.

      For RetryTemplate executions, an instanceof RetryException check identifies a final exception. For Reactor pipelines, Exceptions.isRetryExhausted identifies an exhaustion exception, whereas instanceof TimeoutException reveals a timeout scenario.

      Overrides:
      getFailure in class MethodFailureEvent
      See Also:
    • isRetryAborted

      public boolean isRetryAborted()
      Return whether the current failure led to the retry execution getting aborted, typically indicating exhaustion, interruption or a timeout scenario.

      If this returns true, getFailure() exposes the final exception thrown by the retry infrastructure (rather than thrown by the method itself).

      See Also:
    • toString

      public String toString()
      Overrides:
      toString in class MethodFailureEvent