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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected Throwable
determinePayload
(Throwable throwable, AttributeAccessor context) Build aThrowable payload
for futureErrorMessage
.protected DestinationResolver<MessageChannel>
protected MessagingTemplate
protected Throwable
payloadWhenNull
(AttributeAccessor context) Build aThrowable payload
based on the provided context for futureErrorMessage
when there is originalThrowable
.void
publish
(Throwable throwable, AttributeAccessor context) Publish an error message for the supplied throwable and context.void
Publish an error message for the supplied message and throwable.void
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
(MessagingException exception) Publish an error message for the supplied exception.void
setBeanFactory
(BeanFactory beanFactory) final void
setChannel
(MessageChannel channel) void
setChannelName
(String channelName) final void
setChannelResolver
(DestinationResolver<MessageChannel> channelResolver) final void
setErrorMessageStrategy
(ErrorMessageStrategy errorMessageStrategy) final void
setSendTimeout
(long sendTimeout)
-
Field Details
-
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:
setBeanFactory
in 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 aMessagingException
containing the message in itsfailedMessage
property, 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, Message<?> failedMessage, Throwable throwable) Publish an error message for the supplied message and throwable. If the throwable is already aMessagingException
containing the message in itsfailedMessage
property, 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. TheerrorMessageStrategy
is used to build aErrorMessage
to publish.- Parameters:
throwable
- the throwable. May be null.context
- the context forErrorMessage
properties.
-
determinePayload
Build aThrowable payload
for futureErrorMessage
.- Parameters:
throwable
- the error to determine anErrorMessage
payload. Can be null.context
- the context for error.- Returns:
- the throwable for the
ErrorMessage
payload - See Also:
-
payloadWhenNull
Build aThrowable payload
based on the provided context for futureErrorMessage
when there is originalThrowable
.- Parameters:
context
- theAttributeAccessor
to use for exception properties.- Returns:
- the
Throwable
for anErrorMessage
payload. - See Also:
-