Interface MessageDeliveryErrorHandler

    • Method Detail

      • isPermanentError

        boolean isPermanentError​(QueuedMessage queuedMessage,
                                 Exception error)
        This method is called when the DurableQueueConsumer experiences an exception during Message delivery.
        The result of this method determines if the Message is instantly marked as a Poison-Message/Dead-Letter-Message or if we can attempt message redelivery according to the specified RedeliveryPolicy
        Parameters:
        queuedMessage - the message that failed to be delivered
        error - the error experienced
        Returns:
        true if the error is a permanent error - in which case the message is instantly marked as an Poison-Message/Dead-Letter-Message, otherwise false - in which case the message will be redelivered according to the specified RedeliveryPolicy
      • stopRedeliveryOn

        static MessageDeliveryErrorHandler stopRedeliveryOn​(Class<? extends Exception>... exceptions)
        Create a MessageDeliveryErrorHandler that stops message redelivery in case message handling experiences an exception for in the array of exceptions.
        It will first attempt to match directly on Exception class, next it will attempt to match on hierarchy (i.e. a concrete error which is a subtype of an Exception found in the exceptions will also match)
        Parameters:
        exceptions - the array of exceptions where message redelivery will be stopped and the Message will be instantly marked as an Poison-Message/Dead-Letter-Message or
        Returns:
        a MessageDeliveryErrorHandler that stops message redelivery in case message handling experiences an exception for in the list of exceptions
      • stopRedeliveryOn

        static MessageDeliveryErrorHandler stopRedeliveryOn​(List<Class<? extends Exception>> exceptions)
        Create a MessageDeliveryErrorHandler that stops message redelivery in case message handling experiences an exception for in the list of exceptions.
        It will first attempt to match directly on Exception class, next it will attempt to match on hierarchy (i.e. a concrete error which is a subtype of an Exception found in the exceptions will also match)
        Parameters:
        exceptions - the list of exceptions where message redelivery will be stopped and the Message will be instantly marked as a Poison-Message/Dead-Letter-Message
        Returns:
        a MessageDeliveryErrorHandler that stops message redelivery in case message handling experiences an exception for in the list of exceptions