Thanks for your suggestions.
I decided to switch to asynchronous processing with single consumer just like you wrote.
I also work on adapting approach with retry interceptor and dead letters queue. I want the problematic message to be send to dead letters queue after 3 failures. Unfortunately, when I throw AmqpRejectAndDontRequeueException in my message recoverer I got the following:
Code:
12-10-12 17:01:55:500 - {WARN} listener.SimpleMessageListenerContainer Thread [SimpleAsyncTaskExecutor-1]; Consumer raised exception, processing can restart if the connection factory supports it. Exception summary: org.springframework.amqp.AmqpRejectAndDontRequeueException:
12-10-12 17:01:55:505 - {INFO} listener.SimpleMessageListenerContainer Thread [SimpleAsyncTaskExecutor-1]; Restarting Consumer: tag=[amq.ctag-Qlp3--gG_COX49OrFzf25k], channel=Cached Rabbit Channel: AMQChannel(amqp://guest@10.10.0.52:5672/,2), acknowledgeMode=AUTO local queue size=0
Then the application doesnt consume messages anymore. If I dont use retry interceptor and throw AmqpRejectAndDontRequeueException in my delegate I dont get any warns and consumer still works. In both cases bad message doesnt appear in dead letter queue - frankly, Im not sure how to make consumer use my dead queue.