public class ErrorMessagePublisher extends Object implements BeanFactoryAware
An ErrorMessageStrategy can be used to provide customization for the target
ErrorMessage based on the AttributeAccessor (or the message and/or
throwable when using the other publish() methods).
| Modifier and Type | Field and Description |
|---|---|
protected Log |
logger |
protected MessagingTemplate |
messagingTemplate |
| Constructor and Description |
|---|
ErrorMessagePublisher() |
| Modifier and Type | Method and Description |
|---|---|
protected Throwable |
determinePayload(Throwable throwable,
AttributeAccessor context)
Build a
Throwable payload for future ErrorMessage. |
MessageChannel |
getChannel() |
protected DestinationResolver<MessageChannel> |
getChannelResolver() |
ErrorMessageStrategy |
getErrorMessageStrategy() |
protected MessagingTemplate |
getMessagingTemplate() |
protected Throwable |
payloadWhenNull(AttributeAccessor context)
Build a
Throwable payload based on the provided context
for future ErrorMessage when there is original Throwable. |
void |
publish(Message<?> inputMessage,
Message<?> failedMessage,
Throwable throwable)
Publish an error message for the supplied message and throwable.
|
void |
publish(Message<?> inputMessage,
MessagingException exception)
Publish an error message for the supplied exception.
|
void |
publish(Message<?> failedMessage,
Throwable throwable)
Publish an error message for the supplied message and throwable.
|
void |
publish(MessagingException exception)
Publish an error message for the supplied exception.
|
void |
publish(Throwable throwable,
AttributeAccessor context)
Publish an error message for the supplied throwable and context.
|
void |
setBeanFactory(BeanFactory beanFactory) |
void |
setChannel(MessageChannel channel) |
void |
setChannelName(String channelName) |
void |
setChannelResolver(DestinationResolver<MessageChannel> channelResolver) |
void |
setErrorMessageStrategy(ErrorMessageStrategy errorMessageStrategy) |
void |
setSendTimeout(long sendTimeout) |
protected final Log logger
protected final MessagingTemplate messagingTemplate
public final void setErrorMessageStrategy(ErrorMessageStrategy errorMessageStrategy)
public final void setChannel(MessageChannel channel)
public void setChannelName(String channelName)
public ErrorMessageStrategy getErrorMessageStrategy()
public MessageChannel getChannel()
public final void setSendTimeout(long sendTimeout)
public final void setChannelResolver(DestinationResolver<MessageChannel> channelResolver)
public void setBeanFactory(BeanFactory beanFactory)
setBeanFactory in interface BeanFactoryAwareprotected MessagingTemplate getMessagingTemplate()
@Nullable protected DestinationResolver<MessageChannel> getChannelResolver()
public void publish(MessagingException exception)
exception - the exception.public void publish(Message<?> failedMessage, Throwable throwable)
MessagingException containing the message in its
failedMessage property, use publish(MessagingException) instead.failedMessage - the message.throwable - the throwable.public void publish(Message<?> inputMessage, MessagingException exception)
inputMessage - the message that started the subflow.exception - the exception.public void publish(@Nullable Message<?> inputMessage, Message<?> failedMessage, Throwable throwable)
MessagingException containing the message in its
failedMessage property, use publish(MessagingException) instead.inputMessage - the message that started the subflow.failedMessage - the message.throwable - the throwable.public void publish(Throwable throwable, AttributeAccessor context)
errorMessageStrategy is used to build a ErrorMessage
to publish.throwable - the throwable. May be null.context - the context for ErrorMessage properties.protected Throwable determinePayload(Throwable throwable, AttributeAccessor context)
Throwable payload for future ErrorMessage.throwable - the error to determine an ErrorMessage payload. Can be null.context - the context for error.ErrorMessage payloadErrorMessageUtilsprotected Throwable payloadWhenNull(AttributeAccessor context)
Throwable payload based on the provided context
for future ErrorMessage when there is original Throwable.context - the AttributeAccessor to use for exception properties.Throwable for an ErrorMessage payload.ErrorMessageUtils