I have a 3 Node Rabbit MQ setup. All the queue are being created at runtime.
If i don't mirror the queues then a particular queue will be created on suppose Node1 and will not be present in Node2 and Node3
Now if i use the Spring AMQP client as then how will it ensure the the queue1 which is available on Node 1, It will always connect to Node 1 to access the queue1
rabbit:connection-factory id="connectionFactory" addresses="host1, host2, host3" username="username" password="password"
The other way is to use ha-mode all where each queue when created on any node will get replicate to the rest of the Nodes as well. This will ensure HA and 100% Guarantee of message to be consume whether the client connects on any of the nodes. BUT ITS A NOT A DESIRED OR GOOD SOLUTION
I am looking for the solution if no HA policy if being defined.
See the documentation about Queue Affinity and the LocalizedQueueConnectionFactory.
While it was designed for HA queues, it will work for any queue and connect to the node that hosts the queue (if available).
It requires the management plugin; it uses the REST API to determine which node hosts a queue.
If the queue is durable and the hosting node is down, set missingQueuesFatal
to false
so the listener container will continue to keep trying. Missing queues are treated as fatal by default and the container will stop.