Load RabbitMQ config at startup

rabbitmq

Solution

There's two bits that the documentation leaves to be desired that were stumbling blocks for me.

Generating the definitions file

I found the easiest way to do that is to configure one RabbitMQ server how you like it and then...

- Go to the management web interface

- Look at the bottom of the Overview tab/page for the "Import / export definitions" heading

- Click the "Download broker definitions" button in that section

Configuring RabbitMQ to look for a definitions file at startup

- Put the definitions file somewhere on the filesystem that it can be read by the user that your rabbitmq daemon will be running as.

Include a block like this in the configuration file:

`{rabbitmq_management, [ {listener, [...]}, {load_definitions, "/etc/rabbitmq/definitions.json"} ]},`

Upon startup, those definitions should get loaded. Any errors loading them should be apparent in the logs.

Problem

How do I load a RabbitMQ config at startup to confirm that broker objects (queues, exchanges, bindings, users, virtual hosts, permissions and parameters) are created? According to the RabbitMQ documentation, it can be done via `load_definitions` http://www.rabbitmq.com/management.html#load-definitions But I can't figure out how to use it. Would someone mind sharing an example of how this works? I can't find any examples online.

Original source