Class ErrorMessagePublisher
java.lang.Object
org.springframework.integration.core.ErrorMessagePublisher
- All Implemented Interfaces:
Aware,BeanFactoryAware
- Direct Known Subclasses:
ErrorMessageSendingRecoverer,KafkaErrorSendingMessageRecoverer,MessagePublishingErrorHandler
The component which can be used as general purpose of errors publishing.
Can be called or extended in any error handling or retry scenarios.
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).
- Since:
- 4.3.10
- Author:
- Artem Bilan, Gary Russell
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final org.apache.commons.logging.Logprotected final MessagingTemplate -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ThrowabledeterminePayload(@Nullable Throwable throwable, AttributeAccessor context) Build aThrowable payloadfor futureErrorMessage.@Nullable MessageChannelprotected DestinationResolver<MessageChannel> protected MessagingTemplateprotected ThrowablepayloadWhenNull(AttributeAccessor context) Build aThrowable payloadbased on the provided context for futureErrorMessagewhen there is originalThrowable.voidpublish(@Nullable Throwable throwable, AttributeAccessor context) Publish an error message for the supplied throwable and context.voidPublish an error message for the supplied message and throwable.voidPublish an error message for the supplied message and throwable.voidpublish(Message<?> inputMessage, MessagingException exception) Publish an error message for the supplied exception.voidpublish(MessagingException exception) Publish an error message for the supplied exception.voidsetBeanFactory(BeanFactory beanFactory) final voidsetChannel(MessageChannel channel) voidsetChannelName(String channelName) final voidsetChannelResolver(DestinationResolver<MessageChannel> channelResolver) final voidsetErrorMessageStrategy(ErrorMessageStrategy errorMessageStrategy) final voidsetSendTimeout(long sendTimeout)
-
Field Details
-
logger
protected final org.apache.commons.logging.Log logger -
messagingTemplate
-
-
Constructor Details
-
ErrorMessagePublisher
public ErrorMessagePublisher()
-
-
Method Details
-
setErrorMessageStrategy
-
setChannel
-
setChannelName
-
getErrorMessageStrategy
-
getChannel
-
setSendTimeout
public final void setSendTimeout(long sendTimeout) -
setChannelResolver
-
setBeanFactory
- Specified by:
setBeanFactoryin interfaceBeanFactoryAware
-
getMessagingTemplate
-
getChannelResolver
-
publish
Publish an error message for the supplied exception.- Parameters:
exception- the exception.
-
publish
Publish an error message for the supplied message and throwable. If the throwable is already aMessagingExceptioncontaining the message in itsfailedMessageproperty, usepublish(MessagingException)instead.- Parameters:
failedMessage- the message.throwable- the throwable.
-
publish
Publish an error message for the supplied exception.- Parameters:
inputMessage- the message that started the subflow.exception- the exception.
-
publish
public void publish(@Nullable Message<?> inputMessage, @Nullable Message<?> failedMessage, Throwable throwable) Publish an error message for the supplied message and throwable. If the throwable is already aMessagingExceptioncontaining the message in itsfailedMessageproperty, usepublish(MessagingException)instead.- Parameters:
inputMessage- the message that started the subflow.failedMessage- the message.throwable- the throwable.
-
publish
Publish an error message for the supplied throwable and context. TheerrorMessageStrategyis used to build aErrorMessageto publish.- Parameters:
throwable- the throwable. Maybe null.context- the context forErrorMessageproperties.
-
determinePayload
Build aThrowable payloadfor futureErrorMessage.- Parameters:
throwable- the error to determine anErrorMessagepayload. Can be null.context- the context for error.- Returns:
- the throwable for the
ErrorMessagepayload - See Also:
-
payloadWhenNull
Build aThrowable payloadbased on the provided context for futureErrorMessagewhen there is originalThrowable.- Parameters:
context- theAttributeAccessorto use for exception properties.- Returns:
- the
Throwablefor anErrorMessagepayload. - See Also:
-