[rabbitmq-discuss] Exchange and queue naming conventions

Michael Klishin michael.s.klishin at gmail.com
Tue Jan 25 07:50:24 GMT 2011


2011/1/25 Bill Moseley <moseley at hank.org>

> I do think it makes sense to use the dotted notation, and then use topic
> queues as that makes for very flexible routing options.  I was wondering if
> anyone had worked out some "best practices" over time that would be useful
> as we start to add more tasks.
>

1+ year and several apps later I see the following pattern developing on my
team:

1. Exchanges are declared by producers.
2. Queues are declared and bound by consumers.
3. In vast majority of cases, consumers are "smart" and producers are very
dumb: they just put messages in well-known places. Consumers
    are "smart" in a sense that they almost always keep some persistent
state (in Redis, for example), while producers are just monitored in case
they crash.
4. Exchanges are named using the following pattern
$prefix.$applications_group.$app.$environment. For example,
megacorp.mail_delivery.shaper.qa or
megacorp.search.online_indexer.production. It works well with multiple
installations and if you want to route some data to your
customers/partners/archive.

Also, it becomes increasingly obvious that many exchanges and bindings would
be unnecessary if we begin to use default exchange more.



> BTW -- in that case can I configure binding for three queues:
>  *.qa.rotate_image. *.production.rotate_image, and then a third for all
> except "qa" a and "production"?
>

"Except" case is not handled by AMQP very well (not in 0.9.1 I am most
familiar with, anyway). Maybe *.other.rotate_image would be good enough?


Finally, I'm still a bit confused when to create new exchanges (assuming all
> the same type).  Just trying to get some basic guidelines.  Is there any
> overhead with using more exchanges vs. just more bindings on the same
> exchange?  Is is common to use separate exchanges for grouping consumers
> (i.e. an exchange for report queues and another exchange for image
> manipulation queues)?
>


Unless you have thousands of them on a small box, it probably does not make
much difference. For support cases, dealing with apps that use 150 exchanges
may be significantly more difficult than if they were using just 3, though.

Hope this helps.
-- 
MK
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20110125/faee74e5/attachment-0001.htm>


More information about the rabbitmq-discuss mailing list