Class ErrorMessagePublisher

java.lang.Object
org.springframework.integration.core.ErrorMessagePublisher
All Implemented Interfaces:
Aware, BeanFactoryAware
Direct Known Subclasses:
ErrorMessageSendingRecoverer, KafkaErrorSendingMessageRecoverer, MessagePublishingErrorHandler

public class ErrorMessagePublisher extends Object implements BeanFactoryAware
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 Details Link icon

    • logger Link icon

      protected final Log logger
    • messagingTemplate Link icon

      protected final MessagingTemplate messagingTemplate
  • Constructor Details Link icon

    • ErrorMessagePublisher Link icon

      public ErrorMessagePublisher()
  • Method Details Link icon

    • setErrorMessageStrategy Link icon

      public final void setErrorMessageStrategy(ErrorMessageStrategy errorMessageStrategy)
    • setChannel Link icon

      public final void setChannel(MessageChannel channel)
    • setChannelName Link icon

      public void setChannelName(String channelName)
    • getErrorMessageStrategy Link icon

      public ErrorMessageStrategy getErrorMessageStrategy()
    • getChannel Link icon

      public MessageChannel getChannel()
    • setSendTimeout Link icon

      public final void setSendTimeout(long sendTimeout)
    • setChannelResolver Link icon

      public final void setChannelResolver(DestinationResolver<MessageChannel> channelResolver)
    • setBeanFactory Link icon

      public void setBeanFactory(BeanFactory beanFactory)
      Specified by:
      setBeanFactory in interface BeanFactoryAware
    • getMessagingTemplate Link icon

      protected MessagingTemplate getMessagingTemplate()
    • getChannelResolver Link icon

      @Nullable protected DestinationResolver<MessageChannel> getChannelResolver()
    • publish Link icon

      public void publish(MessagingException exception)
      Publish an error message for the supplied exception.
      Parameters:
      exception - the exception.
    • publish Link icon

      public void publish(Message<?> failedMessage, Throwable throwable)
      Publish an error message for the supplied message and throwable. If the throwable is already a MessagingException containing the message in its failedMessage property, use publish(MessagingException) instead.
      Parameters:
      failedMessage - the message.
      throwable - the throwable.
    • publish Link icon

      public void publish(Message<?> inputMessage, MessagingException exception)
      Publish an error message for the supplied exception.
      Parameters:
      inputMessage - the message that started the subflow.
      exception - the exception.
    • publish Link icon

      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 a MessagingException containing the message in its failedMessage property, use publish(MessagingException) instead.
      Parameters:
      inputMessage - the message that started the subflow.
      failedMessage - the message.
      throwable - the throwable.
    • publish Link icon

      public void publish(Throwable throwable, AttributeAccessor context)
      Publish an error message for the supplied throwable and context. The errorMessageStrategy is used to build a ErrorMessage to publish.
      Parameters:
      throwable - the throwable. May be null.
      context - the context for ErrorMessage properties.
    • determinePayload Link icon

      protected Throwable determinePayload(Throwable throwable, AttributeAccessor context)
      Build a Throwable payload for future ErrorMessage.
      Parameters:
      throwable - the error to determine an ErrorMessage payload. Can be null.
      context - the context for error.
      Returns:
      the throwable for the ErrorMessage payload
      See Also:
    • payloadWhenNull Link icon

      protected Throwable payloadWhenNull(AttributeAccessor context)
      Build a Throwable payload based on the provided context for future ErrorMessage when there is original Throwable.
      Parameters:
      context - the AttributeAccessor to use for exception properties.
      Returns:
      the Throwable for an ErrorMessage payload.
      See Also: