Class RejectAndDontRequeueRecoverer

java.lang.Object
org.springframework.amqp.rabbit.retry.RejectAndDontRequeueRecoverer
All Implemented Interfaces:
MessageRecoverer

public class RejectAndDontRequeueRecoverer extends Object implements MessageRecoverer
MessageRecover that causes the listener container to reject the message without requeuing. This enables failed messages to be sent to a Dead Letter Exchange/Queue, if the broker is so configured.
Since:
1.1.2
Author:
Gary Russell
  • Field Details

    • logger

      protected final Log logger
  • Constructor Details

    • RejectAndDontRequeueRecoverer

      public RejectAndDontRequeueRecoverer()
      Construct an instance with the default exception message.
    • RejectAndDontRequeueRecoverer

      public RejectAndDontRequeueRecoverer(String message)
      Construct an instance with the provided exception message.
      Parameters:
      message - the message.
      Since:
      2.3.7
    • RejectAndDontRequeueRecoverer

      public RejectAndDontRequeueRecoverer(Supplier<String> messageSupplier)
      Construct an instance with the provided exception message supplier.
      Parameters:
      messageSupplier - the message supplier.
      Since:
      2.3.7
  • Method Details

    • recover

      public void recover(Message message, Throwable cause)
      Description copied from interface: MessageRecoverer
      Callback for message that was consumed but failed all retry attempts.
      Specified by:
      recover in interface MessageRecoverer
      Parameters:
      message - the message to recover
      cause - the cause of the error