how configure timeouts, retries or max-attempts in differents queues with spring rabbitmq

Viewed 4507

Is it possible to make these settings for each queue? I have queues that are important so i need a larger number of retries, but have less important queues that I do not want to configure retry, attempt, etc

public Queue newQueue(String name) {
    return new Queue(name, durable, exclusive, autoDelete, arguments);
}

I saw that in the Queue class, it is possible to pass an argument map as the last parameter, but I do not know if it would be here, or via properties.

3 Answers

I was able change max retries and back-off strategy in configuration like this:

spring:
  rabbitmq:
    listener:
      simple:
        retry:
          enabled: true
          initial-interval: 1000
          max-attempts: 3
          max-interval: 10000
          multiplier: 2.0

Messages that are still failing will be discarded with a warning with this config. See this article for configuring dead letter queue

Related