Class ErrorMessageSendingRecoverer
java.lang.Object
org.springframework.integration.core.ErrorMessagePublisher
org.springframework.integration.handler.advice.ErrorMessageSendingRecoverer
- All Implemented Interfaces:
org.springframework.beans.factory.Aware
,org.springframework.beans.factory.BeanFactoryAware
,org.springframework.retry.RecoveryCallback<java.lang.Object>
public class ErrorMessageSendingRecoverer extends ErrorMessagePublisher implements org.springframework.retry.RecoveryCallback<java.lang.Object>
A
RecoveryCallback
that sends the final throwable as an
ErrorMessage
after
retry exhaustion.- Since:
- 2.2
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ErrorMessageSendingRecoverer.RetryExceptionNotAvailableException
-
Field Summary
Fields inherited from class org.springframework.integration.core.ErrorMessagePublisher
logger, messagingTemplate
-
Constructor Summary
Constructors Constructor Description ErrorMessageSendingRecoverer()
Construct instance with the defaulterrorChannel
to publish recovery error message.ErrorMessageSendingRecoverer(org.springframework.messaging.MessageChannel channel)
Construct instance based on the provided message channel.ErrorMessageSendingRecoverer(org.springframework.messaging.MessageChannel channel, ErrorMessageStrategy errorMessageStrategy)
Construct instance based on the provided message channel andErrorMessageStrategy
. -
Method Summary
Modifier and Type Method Description protected java.lang.Throwable
payloadWhenNull(org.springframework.core.AttributeAccessor context)
Build aThrowable payload
based on the provided context for futureErrorMessage
when there is originalThrowable
.java.lang.Object
recover(org.springframework.retry.RetryContext context)
Methods inherited from class org.springframework.integration.core.ErrorMessagePublisher
determinePayload, getChannel, getChannelResolver, getErrorMessageStrategy, getMessagingTemplate, publish, publish, publish, publish, publish, setBeanFactory, setChannel, setChannelName, setChannelResolver, setErrorMessageStrategy, setSendTimeout
-
Constructor Details
-
ErrorMessageSendingRecoverer
public ErrorMessageSendingRecoverer()Construct instance with the defaulterrorChannel
to publish recovery error message. TheDefaultErrorMessageStrategy
is used for building error message to publish.- Since:
- 4.3.10
-
ErrorMessageSendingRecoverer
public ErrorMessageSendingRecoverer(org.springframework.messaging.MessageChannel channel)Construct instance based on the provided message channel. TheDefaultErrorMessageStrategy
is used for building error message to publish.- Parameters:
channel
- the message channel to publish error messages on recovery action.
-
ErrorMessageSendingRecoverer
public ErrorMessageSendingRecoverer(org.springframework.messaging.MessageChannel channel, ErrorMessageStrategy errorMessageStrategy)Construct instance based on the provided message channel andErrorMessageStrategy
. In the event providedErrorMessageStrategy
is null, theDefaultErrorMessageStrategy
will be used.- Parameters:
channel
- the message channel to publish error messages on recovery action.errorMessageStrategy
- theErrorMessageStrategy
to build error message for publishing. Can be null at which point theDefaultErrorMessageStrategy
is used.- Since:
- 4.3.10
-
-
Method Details
-
recover
public java.lang.Object recover(org.springframework.retry.RetryContext context)- Specified by:
recover
in interfaceorg.springframework.retry.RecoveryCallback<java.lang.Object>
-
payloadWhenNull
protected java.lang.Throwable payloadWhenNull(org.springframework.core.AttributeAccessor context)Description copied from class:ErrorMessagePublisher
Build aThrowable payload
based on the provided context for futureErrorMessage
when there is originalThrowable
.- Overrides:
payloadWhenNull
in classErrorMessagePublisher
- Parameters:
context
- theAttributeAccessor
to use for exception properties.- Returns:
- the
Throwable
for anErrorMessage
payload. - See Also:
ErrorMessageUtils
-