Class MethodRollbackEvent

All Implemented Interfaces:
Serializable

public class MethodRollbackEvent extends MethodFailureEvent
Event published for every exception encountered that triggers a transaction rollback through a proxy-triggered method invocation or a reactive publisher returned from it. Can be listened to via an ApplicationListener<MethodRollbackEvent> bean or an @EventListener(MethodRollbackEvent.class) method.

Note: This event gets published right before the actual transaction rollback. As a consequence, the exposed transaction reflects the state of the transaction right before the rollback.

Since:
7.0.3
Author:
Juergen Hoeller
See Also:
  • Constructor Details

    • MethodRollbackEvent

      public MethodRollbackEvent(MethodInvocation invocation, Throwable failure, TransactionExecution transaction)
      Create a new event for the given rolled-back method invocation.
      Parameters:
      invocation - the transactional method invocation
      failure - the exception encountered that triggered a rollback
      transaction - the transaction status right before the rollback
  • 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.

      Overrides:
      getFailure in class MethodFailureEvent
    • getTransaction

      public TransactionExecution getTransaction()
      Return the corresponding transaction status.