Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RabbitMQ mirroring queues and exchanges

Is it possible to use federations or shovels to mirror the creation of exchanges and queues on one server to another ?

All the examples I've seen of using shovels and federations use exchanges and queues that already exist on the servers. What I want to do is create an exchange on server A and have a federation or shovel re-create it on Server B then start to send messages to it.

If this cannot be done with a federation or shovel is there anyway of achieving this without using clustering, the connection between the two servers is not consistent so clustering isn't possible.

I'm running RabbitMQ on windows.

like image 213
user1450877 Avatar asked Apr 08 '14 20:04

user1450877


2 Answers

You can use the federation plug-in.

It supports the exchange exchange and the queue federation, in order to mirror the queues and exchanges you can configure a policies ( using the management console or command line),for example with this parameters:

Name: my_policy 
Pattern: ^mirr\.  <---- mirror exchanges and queues with prefix “mirr.” 
Definition: federation-upstream-set:all 

you can apply the configuration for exchanges and queues, as:

enter image description here

The pattern policy supports regular expression

In this way each new or old exchange or queue that starts with the prefix “mirr.” will be mirrored to the other broker.

I think this could solve your problem.

like image 184
Gabriele Santomaggio Avatar answered Sep 18 '22 15:09

Gabriele Santomaggio


Unfortunately in this way it is not possible to do this, because the connection is a point-to-point connection. You have to link a exchange with a remote exchange and in your topology this cant be created automatically.

I had also this problem in the past. And how i resolved the problem was over a business logic side. If there was a need for a new Exchange/Queue "on the fly", my data input gateway recognized this and created on the local and on the remote exchange the new exchange and queues with the connection, before the message was sent to RabbitMQ.

like image 24
Rene Herget Avatar answered Sep 18 '22 15:09

Rene Herget