Some days ago I realized spring-multirabbit
had a bug that affected the retry support since its first version.
I was browsing for spring-multirabbit
in stackoverflow and found this question reporting the issue
which was also linked to the original issue that I took but never had the time to check. Thank you folks
that opened the question and issue.
I just launched the following spring-multirabbit
versions that fix it:
And here is how to use it.
Suppose three brokers, where the first is the default configuration under spring.rabbitmq
and there are two other
brokers, configured under broker1
and broker2
.
There is no inheritance logic for the retry logic, therefore every broker needs to be configured accordingly.
spring.rabbitmq.listener.simple.retry.enabled = true
spring.rabbitmq.listener.simple.retry.initial-interval = 1000
spring.rabbitmq.listener.simple.retry.max-attempts = 5
spring.multirabbitmq.enabled = true
spring.multirabbitmq.connections.broker1.listener.simple.retry.enabled = true
spring.multirabbitmq.connections.broker1.listener.simple.retry.initial-interval = 2000
spring.multirabbitmq.connections.broker1.listener.simple.retry.max-attempts = 10
spring.multirabbitmq.connections.broker2.listener.simple.retry.enabled = true
spring.multirabbitmq.connections.broker2.listener.simple.retry.initial-interval = 5000
spring.multirabbitmq.connections.broker2.listener.simple.retry.max-attempts = 20
In the example configuration, the default connection is configured with 5 retries with 1sec interval, while broker1
is
configured with 10 retries with 2sec interval and broker2
is configured with 20 retries with 5sec interval.