Let's say that I have in my Spring project a predefined JSON file that is consisted of all the queue names on my RabbitMQ server, but with some modifications.
Example: RabbitMQ server state before migration:
- Queue1
- Queue2
- Queue3
JSON config file:
- Queue1
- Queue2
- Queue3Renamed
- Queue4New
RabbitMQ server state after the migration:
- Queue1
- Queue2
- Queue3Renamed
- Queue4New
After the migration , some Queue's need to be updated(the name for example) or maybe a new queue needs to be created on the server, depends on the definitions in the JSON file. Also, another thing to bear in mind that is if a queue needs to be renamed, it may contain messages which mustn't be deleted.
Any ides on how to approach this problem?
CodePudding user response:
You cannot "rename" queues; they are immutable; you can only create new ones.
You can use the RabbitMQ rest API to examine the current configuration and a RabbitAdmin
to declare new queues.