Announcement Announcement Module
No announcement yet.
Namespace support for defaultRequeueRejected on amqp:channel Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Namespace support for defaultRequeueRejected on amqp:channel

    I am using an amqp-backed channel (amqp:channel). Is there a work-around to being able to stop rejected messages from being sent back to queue ? Acknowledge-mode is AUTO and channel-transacted is TRUE. I have an error-handler defined (MessagePublishingErrorHandler) that sends the error message to the errorChannel. But I don't want the original message sent back to the queue.


  • #2
    I realize this is an old post, but I figured I'd post a solution for future fellow googlers. The easiest way to deal with this right now is to implement your own org.springframework.util.ErrorHandler and rethrow any exception as org.springframework.amqp.AmqpRejectAndDontRequeueE xception, say something like this:

    public class AmqpExceptionChannelErrorHandler implements ErrorHandler {
        public void handleError(Throwable t) {
            throw new AmqpRejectAndDontRequeueException(t);
    Then set your error-handler for your amqp pubsub channel:

    <int-amqp:publish-subscribe-channel error-handler="amqpExceptionChannelErrorHandler" id="some-channel-id"
            connection-factory="rabbitConnectionFactory" />
    Of course you'll want to DO something after this exception is thrown once and only once, but that's entirely up to your needs.


    • #3
      Thanks for posting your solution - it looks like this question fell through the cracks, for which we apologize.