Class ListenerExecutionFailedException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
io.awspring.cloud.sqs.listener.ListenerExecutionFailedException
All Implemented Interfaces:
Serializable

public class ListenerExecutionFailedException extends RuntimeException
Exception thrown when the AsyncMessageListener completes with an exception. Contains the Message instance or instances which execution failed, as well as some convenience methods for handling such messages.
Since:
3.0
Author:
Tomaz Fernandes
See Also:
  • Constructor Details

    • ListenerExecutionFailedException

      public ListenerExecutionFailedException(String message, Throwable cause, Message<?> failedMessage)
    • ListenerExecutionFailedException

      public ListenerExecutionFailedException(String message, Throwable cause, Collection<Message<T>> failedMessages)
  • Method Details

    • getFailedMessage

      public Message<?> getFailedMessage()
      Return the message which listener execution failed.
      Returns:
      the message.
    • getFailedMessages

      public Collection<Message<?>> getFailedMessages()
      Return the messages which listener execution failed.
      Returns:
      the messages.
    • unwrapMessage

      @Nullable public static <T> Message<T> unwrapMessage(Throwable t)
      Look for a potentially nested ListenerExecutionFailedException and if found return the wrapped Message instance.
      Type Parameters:
      T - the message type.
      Parameters:
      t - the throwable
      Returns:
      the message.
    • unwrapMessages

      @Nullable public static <T> Collection<Message<T>> unwrapMessages(Throwable t)
      Look for a potentially nested ListenerExecutionFailedException and if found return the wrapped Message instances.
      Type Parameters:
      T - the message type.
      Parameters:
      t - the throwable
      Returns:
      the messages.
    • hasListenerException

      public static boolean hasListenerException(Throwable t)