rabbitmq / rabbitmq-federation

RabbitMQ Federation plugin
https://www.rabbitmq.com/
Other
40 stars 21 forks source link

Queue federation sets routing key to source queue name #22

Closed smee closed 9 years ago

smee commented 9 years ago

Queue federation seems to differ in behaviour from exchange federation quite significantly. According to my experiments and the source queue federation changes the routing key to the name of the source queue while exchange federation does not. The documentation does not mention this fact.

Background: I'm evaluating a strategy to update the version of a RMQ-cluster at runtime transparently for users. The logic would be:

  1. Let all clients connect to RabbitMQ via a loadbalancer
  2. Install cluster with new RMQ version in parallel to the production cluster
  3. Copy configuration from old to new cluster (users, permissions, vhosts, exchanges, queues, bindings...)
  4. Use queue federation to ensure that users can consume messages independent of the cluster they are connected to. Works like a charm, apart from the changed routing key and added header fields.
  5. Reconfigure load balancer to enforce that all new client connection go to the new cluster.
  6. Gradually disconnect clients, let them reconnect themselves to the new cluster.

The charm of this usage of queue federation would be that no matter to which cluster a client and a producer are connected to, they can still communicate without being aware of their location.

My question: I would prefer to keep messages transported over queue federation unchanged by the server. Is this possible in any way?

michaelklishin commented 9 years ago

Please ask questions on rabbitmq-users.

Federation has to move messages between nodes and as long as it does so using "regular" means of client connections and consumers/exchanges/etc, it cannot adapt to route every possible message any other way than via default exchange. BCC extension is the only option that may work even in theory.

I'd say relying on the routing key on a message on the consumer end is not a great idea in general. And if you don't do that, the fact that queue federation changes it when a message is re-published shouldn't matter (unless I'm missing something).