Class ErrorMessageSendingRecoverer

java.lang.Object
org.springframework.integration.core.ErrorMessagePublisher
org.springframework.integration.handler.advice.ErrorMessageSendingRecoverer
All Implemented Interfaces:
Aware, BeanFactoryAware, RecoveryCallback<@Nullable Object>

public class ErrorMessageSendingRecoverer extends ErrorMessagePublisher implements RecoveryCallback<@Nullable Object>
A RecoveryCallback that sends the final throwable as an ErrorMessage after retry exhaustion.
Since:
2.2
Author:
Gary Russell, Artem Bilan, Oleg Zhurakousky
  • Constructor Details

    • ErrorMessageSendingRecoverer

      public ErrorMessageSendingRecoverer()
      Construct instance with the default errorChannel to publish a recovery error message. The DefaultErrorMessageStrategy is used for building an error message to publish.
      Since:
      4.3.10
    • ErrorMessageSendingRecoverer

      public ErrorMessageSendingRecoverer(MessageChannel channel)
      Construct an instance based on the provided message channel. The DefaultErrorMessageStrategy is used for building an error message to publish.
      Parameters:
      channel - the message channel to publish error messages on recovery action.
    • ErrorMessageSendingRecoverer

      public ErrorMessageSendingRecoverer(MessageChannel channel, ErrorMessageStrategy errorMessageStrategy)
      Construct instance based on the provided message channel and ErrorMessageStrategy. In the event provided ErrorMessageStrategy is null, the DefaultErrorMessageStrategy will be used.
      Parameters:
      channel - the message channel to publish error messages on recovery action.
      errorMessageStrategy - the ErrorMessageStrategy to build error message for publishing. Can be null at which point the DefaultErrorMessageStrategy is used.
      Since:
      4.3.10
  • Method Details

    • recover

      public @Nullable Object recover(AttributeAccessor context, Throwable cause)
      Specified by:
      recover in interface RecoveryCallback<@Nullable Object>
      Parameters:
      context - the context for failure
      cause - the cause of the failure
      Returns:
      an Object that can be used to replace the callback result that failed