public class ErrorMessageSendingRecoverer extends ErrorMessagePublisher implements org.springframework.retry.RecoveryCallback<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(MessageChannel channel)
Construct instance based on the provided message channel.
|
ErrorMessageSendingRecoverer(MessageChannel channel,
ErrorMessageStrategy errorMessageStrategy)
Construct instance based on the provided message channel and
ErrorMessageStrategy . |
Modifier and Type | Method and Description |
---|---|
protected Throwable |
payloadWhenNull(AttributeAccessor context)
Build a
Throwable payload based on the provided context
for future ErrorMessage when there is original Throwable . |
Object |
recover(org.springframework.retry.RetryContext context) |
determinePayload, getChannel, getChannelResolver, getErrorMessageStrategy, getMessagingTemplate, publish, publish, publish, publish, publish, setBeanFactory, setChannel, setChannelName, setChannelResolver, setErrorMessageStrategy, setSendTimeout
public ErrorMessageSendingRecoverer()
errorChannel
to publish recovery error message.
The DefaultErrorMessageStrategy
is used for building error message to publish.public ErrorMessageSendingRecoverer(MessageChannel channel)
DefaultErrorMessageStrategy
is used for building error message to publish.channel
- the message channel to publish error messages on recovery action.public ErrorMessageSendingRecoverer(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 Object recover(org.springframework.retry.RetryContext context)
recover
in interface org.springframework.retry.RecoveryCallback<Object>
protected Throwable payloadWhenNull(AttributeAccessor context)
ErrorMessagePublisher
Throwable payload
based on the provided context
for future ErrorMessage
when there is original Throwable
.payloadWhenNull
in class ErrorMessagePublisher
context
- the AttributeAccessor
to use for exception properties.Throwable
for an ErrorMessage
payload.ErrorMessageUtils