Toni
Toni

Reputation: 197

Where to create queues and exchanges?

I'm using RabbitMQ as message broker in first time and now I have a question about when to declare queues and exchanges using rabbit's own management tool and when to do it in the code of the software? In my opinion is that it is much better to create queues and exchanges using the management tool, because it's a centralized place to add new or remove useless queues without the need to modify the actual software. I am asking some advice and opinions.

Thank you.

Upvotes: 0

Views: 129

Answers (1)

Derick Bailey
Derick Bailey

Reputation: 72868

The short answer is: whatever works best for you.

I've worked with message brokers that required external tools for defining the topology (exchanges, queues, bindings, etc) and with RabbitMQ that allows me to define them at runtime, as needed.

I don't think either scenario is "the right way". Rather, it depends entirely on your situation.

Personally, I see a lot of value in letting my software define the topology at runtime with RabbitMQ. But there are still times when it gets frustrating because I often end up duplicating my definitions between producers and consumers.

But then, moving from development to production is easier when the software itself defines the topology. No need to pre-configure things before moving code to production.

It's all tradeoffs.

Try it however you're comfortable. Then try it the other way. See what happens, and learn which you prefer and when. Just remember that you don't have to do one or the other. You can do both if you want.

Upvotes: 2

Related Questions