0
votes

I am running multiple instances of the same Spring Boot Application, that consume messages from a rabbitMQ queue

I would like only the first consumer to receive messages while the other instances do not and if I stop the first consumer, the second instance should start to consume messages.

Is this possible and if so, how?

1

1 Answers

0
votes

Fortunately, it's a feature in RabbitMQ since 3.8:

Single Active Consumer

Single active consumer allows to have only one consumer at a time consuming from a queue and to fail over to another registered consumer in case the active one is cancelled or dies.

enter image description here