We have a RabbitMQ cluster with three nodes configured. Each node has two virtual hosts (Vhost-A and Vhost-B). We need a possibility to move messages from Vhost-A to Vhost-B. To accomplish this, we setup a shovel directing messages from Exchange-1 on Vhost-A to Exchange-2 on Vhost-B.
rabbitmqctl -p Vhost-A set_parameter shovel shovel-exchange-1-to-vhost-b /
'{"src-uri": "amqp://user@/Vhost-A", "src-exchange": "Exchange-1", /
"src-exchange-key": "#", "dest-uri": "amqp://user@/Vhost-B", /
"dest-exchange": "Exchange-2", "add-forward-headers": false, /
"ack-mode": "on-confirm", "delete-after": "never"}'
This has the side-effect of replicating the messages on the destination Exchange-2. Meaning, the test-queue we bound to Exchange-2 on Vhost-B receives the same message three times (once from each cluster node).
How can we prevent this? Does it require a change in the shovel configuration or in the cluster configuration?
RabbitMQ version: 3.6.15
UPDATE 1:
We have two exclusive queues that cannot be deleted, because they are locked. Those queues disappear, once we disable shovel plugin on all cluster nodes. As soon as we reactivate the plugin on one node, the queues are created again.
It seems to have been a configuration error. I tested the shovel plugin manually and I must have added shovel configurations to the root ('/') virtual host. For some reason, these did not show up in the management console. Using
rabbitmqctl list_parameters
I saw two additional shovel configurations on the root virtual host. After dropping those shovels, the according queues were removed as well. Adding the shovel as described in the question added the shovel and created one queue. Since then, the message is only forwarded once.
Thank you @Olivier for hinting at multiple shovels. That comment brought me on the right track.