简体   繁体   中英

RabbitMQ - only one queue, with multiple consumers receiving different messages

I have a question about RabbitMQ queue. I would like to send two types of messages on just one queue.

I know that, I can create two different queues, and use routing key to send different messages to different queue.

But I would like to have two consumers on one Queue, and somehow bind Consumer with type of message. It's event's driven via rabbit queue, when client and core are publishers and consumers.

Is it possible, or should I use different Queues?

Data exchange

Like @kendavidson said, there is a possibility to use only one queue, to exchange different messages, but it is terrible idea, because it's not efficient, so you should use it only if it's truly nesesery.

I found comment @Петр Александров useful and I created separate queue for every consumer to fix my problem, and it's something you probably looking for.

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