public class ErrorMessageSendingRecoverer extends ErrorMessagePublisher implements org.springframework.retry.RecoveryCallback<java.lang.Object>
RecoveryCallback that sends the final throwable as an
ErrorMessage after
retry exhaustion.| Modifier and Type | Class and Description |
|---|---|
static class |
ErrorMessageSendingRecoverer.RetryExceptionNotAvailableException |
logger, messagingTemplate| Constructor and Description |
|---|
ErrorMessageSendingRecoverer()
Construct instance with the default
errorChannel
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 and
ErrorMessageStrategy. |
| Modifier and Type | Method and Description |
|---|---|
protected java.lang.Throwable |
payloadWhenNull(org.springframework.core.AttributeAccessor context)
Build a
Throwable payload based on the provided context
for future ErrorMessage when there is original Throwable. |
java.lang.Object |
recover(org.springframework.retry.RetryContext context) |
determinePayload, getChannel, getChannelResolver, getErrorMessageStrategy, getMessagingTemplate, publish, publish, publish, publish, publish, setBeanFactory, setChannel, setChannelName, setChannelResolver, setErrorMessageStrategy, setSendTimeoutpublic ErrorMessageSendingRecoverer()
errorChannel
to publish recovery error message.
The DefaultErrorMessageStrategy is used for building error message to publish.public ErrorMessageSendingRecoverer(org.springframework.messaging.MessageChannel channel)
DefaultErrorMessageStrategy is used for building error message to publish.channel - the message channel to publish error messages on recovery action.public ErrorMessageSendingRecoverer(org.springframework.messaging.MessageChannel channel,
ErrorMessageStrategy errorMessageStrategy)
ErrorMessageStrategy.
In the event provided ErrorMessageStrategy is null, the DefaultErrorMessageStrategy
will be used.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.public java.lang.Object recover(org.springframework.retry.RetryContext context)
throws java.lang.Exception
recover in interface org.springframework.retry.RecoveryCallback<java.lang.Object>java.lang.Exceptionprotected java.lang.Throwable payloadWhenNull(org.springframework.core.AttributeAccessor context)
ErrorMessagePublisherThrowable payload based on the provided context
for future ErrorMessage when there is original Throwable.payloadWhenNull in class ErrorMessagePublishercontext - the AttributeAccessor to use for exception properties.Throwable for an ErrorMessage payload.ErrorMessageUtils