简体   繁体   中英

When to use rabbitmq vHost over separate queue

TL;DR

one queue per message type or one vhost per message type? When to use vHost over separate queue?

Details

Currently, we only have one single queue and several consumers to consume all messages. Those messages have a type property to differentiate from each other. It was well for a long time. But recently, we find some type (say, Type A ) of messages are much more than others, which cause other kinds of message get consumed until a bunch of the Type A messages are consumed.

So we want to separate those messages by their type. The first idea come to me is to create queues for each kind of message. And, then I notice that I can also make use of the vhost for each kind of message.

Is vhost overkill for above scenario? When to use vhost over separate queues?

Virtual hosts provide logical grouping and separation of resources.

RabbitMQ is multi-tenant system, so usually vhost should be used if you want a complete logical separation(resource control, authentication,etc) of Type A message.

In my case we shared RabbitMQ with multiple teams(tenants) each team had its own vhost.

For your case, I think queue should be good solution if you don't want to have a logical separation like different server.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM