简体   繁体   中英

Can RabbitMQ distribute tasks received from an exchange configuration?

Let's consider a standard routing configuration as per documented on the RabbitMQ website defined with 2 routing keys a and b producing 2 associated queues.

I was wondering how to distribute the received messages among multiple workers with the competing consumers pattern : several workers consuming alternatively the messages received from Qa (same approach for Qb ). 在此处输入图片说明

I tried to mix routing with work queues configurations but to no avail since messages are dispatched to all related workers instead of being alternatively distributed.

Is it only possible?

I was wondering how to distribute the received messages among multiple workers

each worker needs it's own queue, and each queue needs to receive a copy of the message

if you send Message.A through an exchange, you need to route Message.A to each of the queues for each worker that needs to process it. You can route a single message to as many queues as you want. The message will be duplicated into each queue.

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