[rabbitmq-discuss] Suggestions for queue rename

Dushin Fred fred at dushin.net
Wed Mar 27 12:35:01 GMT 2013


I am implementing a solution for renaming queues, in the case of a software upgrade, where we have decided to change naming patterns for queues between releases.  This is in a non-clustered environment.  During the upgrade, I can guarantee that the broker is "isolated" (no one publishing or consuming other than the migration code).

I am implementing this as code that runs in the broker, as a plugin, and using an AMQP direct connection.  All of my exchanges are direct, but I have some queues that are bound to the same exchange with different routing keys.

My algorithm is:

input: Exchange E, Queue Q, Routing Key K, new Queue name NQ

Precondition: Q is bound to E via K and \exists Q' != Q bound to E via K

For each Queue Q bound to Exchange E with RoutingKey K
  1. Unbind Q from E
  2. Create new Queue NQ
  3. Create a temporary Exchange TE
  4. Bind NQ to TE with temporary routing key TK
  5. for each message, M, in Q, get M, publish M to TE, ack M
  6. delete exchange TE
  6. Bind E to NQ with routing key K

Postcondition: NQ is bound to E via K and !\exists Q 

Question: Is there an easier way to do this, e.g., via internal APIs in the broker?

Thanks in advance for the free consulting :)

-Fred



More information about the rabbitmq-discuss mailing list