[rabbitmq-discuss] Pre-create queues and exchanges

Simon MacMullen simon at rabbitmq.com
Fri Jun 14 18:02:36 BST 2013


On 14/06/13 14:48, Dmitry Andrianov wrote:
> Hi guys.
> What is the best practices on who should create all the queues and
> exchanges?

Whichever works best for you :)

> I see the three options:
> 1. consumer-app creates everything and it MUST be started before the
> producer-app

That's probably not ideal.

> 2. both consumer-app and producer-app create these objects on startup so
> it does not matter which one starts first.

This is probably closest to "the spirit" of AMQP. I think the 
expectation is that producers and consumers should declare the things 
that they directly interact with. So for example for pub-sub a producer 
would only declare the exchange it would publish to, and then consumers 
declare exchange, queue and binding.

> 3. queues and exchanges are put into the broker configuration so they
> are created automatically when broker starts.

This keeps your apps free of the need to declare things - but it's only 
going to work if your configuration is quite static.

> It looks to me that #3 would be the best way. The apps do not need to
> have any code which initialises stuff, user accounts
> applications use can be restricted etc.
> But I cannot find the "official" way of doing it.
> We tried using shovel plugin because it allows you to declare all these
> queues and exchanges to be created.
> It kind of works but it feels a bit dodgy.

You can do that - or use 
http://www.rabbitmq.com/management.html#load-definitions

Cheers, Simon

-- 
Simon MacMullen
RabbitMQ, Pivotal


More information about the rabbitmq-discuss mailing list