Prisacari Dmitrii
Prisacari Dmitrii

Reputation: 2106

How to rename queue in Rabbitmq?

I'm using Rabbitmq 3.7.17 and I need to rename an existing queue that already contains some messages. Is there a simple way to rename a queue?

Upvotes: 5

Views: 6348

Answers (2)

leonidos79
leonidos79

Reputation: 149

To add to what @user11044402 already recommended, once you created the queue under its NEW name, use the RabbitMQ Shovel plugin if it is installed to move all the messages from the queue with the old name to the new queue. Then delete the old queue - the shovel will be automatically removed as well.

Upvotes: 2

user11044402
user11044402

Reputation:

You can't rename a queue. If you have to keep the messages, follow these steps.

  • Create the new queue.
  • Bind it to the exchange as the old queue was bound.
  • Unbind the old queue from the exchange.
  • Consume the messages from the old queue and republish them to the exchange. This will route the messages to the new queue.
  • Once all messages in the old queue have been consumed, delete it.

Upvotes: 8

Related Questions