Search code examples
rabbitmqspring-integrationrabbitmq-exchangespring-rabbit

Remove message from rabbit MQ after limited attempts of requeing


I put records from a file into rabbit mq,read records from queue and call a service.For rejected records,I am sending a negative acknowledgemnt and requeuing with channel.basicNack method.But requirement is that we need to make only some 3 attempts of service call.After that we have to remove the message from the queue rather keep on calling the service again and again.


Solution

  • On the last attempt, set the requeue argument in basicNack to false.