Question

In RabbitMQ management console, for import and export purpose, I saw this link Import / export definitions at the bottom of the Overview page. But with this I am able to export the entire set of queues, exchanges etc.

I am having an MQ server which contains the MQ setup of multiple applications. I would like to do a selective export of queues, exchanges etc of my application. Is it possible?

Was it helpful?

Solution

I don't think it's built in the tools provided. However, since the output is pure JSON, you can easily remove what is unnecessary.

Example:

#!/usr/bin/python2.7

import json

dump = json.load(open("export.json"))

for k, v in dump.iteritems():
    if k == "queues":
        for i in reversed(range(len(v))):
            if v[i]["name"] not in ["QUEUE#0", "QUEUE#1"]:
                v.pop(i)
        break

open("export-updated.json", "w").write(json.dumps(dump))
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top