public class ErrorMessagePublisher
extends java.lang.Object
implements org.springframework.beans.factory.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 org.apache.commons.logging.Log |
logger |
protected MessagingTemplate |
messagingTemplate |
Constructor and Description |
---|
ErrorMessagePublisher() |
Modifier and Type | Method and Description |
---|---|
protected java.lang.Throwable |
determinePayload(java.lang.Throwable throwable,
org.springframework.core.AttributeAccessor context)
Build a
Throwable payload for future ErrorMessage . |
org.springframework.messaging.MessageChannel |
getChannel() |
protected org.springframework.messaging.core.DestinationResolver<org.springframework.messaging.MessageChannel> |
getChannelResolver() |
ErrorMessageStrategy |
getErrorMessageStrategy() |
protected MessagingTemplate |
getMessagingTemplate() |
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 . |
void |
publish(org.springframework.messaging.Message<?> inputMessage,
org.springframework.messaging.Message<?> failedMessage,
java.lang.Throwable throwable)
Publish an error message for the supplied message and throwable.
|
void |
publish(org.springframework.messaging.Message<?> inputMessage,
org.springframework.messaging.MessagingException exception)
Publish an error message for the supplied exception.
|
void |
publish(org.springframework.messaging.Message<?> failedMessage,
java.lang.Throwable throwable)
Publish an error message for the supplied message and throwable.
|
void |
publish(org.springframework.messaging.MessagingException exception)
Publish an error message for the supplied exception.
|
void |
publish(java.lang.Throwable throwable,
org.springframework.core.AttributeAccessor context)
Publish an error message for the supplied throwable and context.
|
void |
setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) |
void |
setChannel(org.springframework.messaging.MessageChannel channel) |
void |
setChannelName(java.lang.String channelName) |
void |
setChannelResolver(org.springframework.messaging.core.DestinationResolver<org.springframework.messaging.MessageChannel> channelResolver) |
void |
setErrorMessageStrategy(ErrorMessageStrategy errorMessageStrategy) |
void |
setSendTimeout(long sendTimeout) |
protected final org.apache.commons.logging.Log logger
protected final MessagingTemplate messagingTemplate
public final void setErrorMessageStrategy(ErrorMessageStrategy errorMessageStrategy)
public final void setChannel(org.springframework.messaging.MessageChannel channel)
public void setChannelName(java.lang.String channelName)
public ErrorMessageStrategy getErrorMessageStrategy()
public org.springframework.messaging.MessageChannel getChannel()
public final void setSendTimeout(long sendTimeout)
public final void setChannelResolver(org.springframework.messaging.core.DestinationResolver<org.springframework.messaging.MessageChannel> channelResolver)
public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
setBeanFactory
in interface org.springframework.beans.factory.BeanFactoryAware
protected MessagingTemplate getMessagingTemplate()
@Nullable protected org.springframework.messaging.core.DestinationResolver<org.springframework.messaging.MessageChannel> getChannelResolver()
public void publish(org.springframework.messaging.MessagingException exception)
exception
- the exception.public void publish(org.springframework.messaging.Message<?> failedMessage, java.lang.Throwable throwable)
MessagingException
containing the message in its
failedMessage
property, use publish(MessagingException)
instead.failedMessage
- the message.throwable
- the throwable.public void publish(org.springframework.messaging.Message<?> inputMessage, org.springframework.messaging.MessagingException exception)
inputMessage
- the message that started the subflow.exception
- the exception.public void publish(@Nullable org.springframework.messaging.Message<?> inputMessage, org.springframework.messaging.Message<?> failedMessage, java.lang.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(java.lang.Throwable throwable, org.springframework.core.AttributeAccessor context)
errorMessageStrategy
is used to build a ErrorMessage
to publish.throwable
- the throwable. May be null.context
- the context for ErrorMessage
properties.protected java.lang.Throwable determinePayload(java.lang.Throwable throwable, org.springframework.core.AttributeAccessor context)
Throwable payload
for future ErrorMessage
.throwable
- the error to determine an ErrorMessage
payload. Can be null.context
- the context for error.ErrorMessage
payloadErrorMessageUtils
protected java.lang.Throwable payloadWhenNull(org.springframework.core.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