RabbitMQ:使用单个队列进行主题交换的消息循环分发 [英] RabbitMQ : Round robin distribution of messages with Topic exchange with single queue

查看:56
本文介绍了RabbitMQ:使用单个队列进行主题交换的消息循环分发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

RabbitMQ 是否在以下情况下循环分发消息?

Does RabbitMQ do round robin distribution of messages in following situation ?

RabbitMQ 配置:

RabbitMQ configuration :

  1. 交流类型 - 主题
  2. 路由密钥 - 通知.#

生产者正在将消息推送到上面的交换器不同的主题-

Producer is pushing the message to above exchange with following different topics-

notify.log.#、notify.status.#、notify.priceChange.#

notify.log.# , notify.status.#, notify.priceChange.#

有 4 个消费者在不同的服务器上运行.

There are 4 consumers are running on different servers.

  1. 3 个消费者在负载均衡器下执行相同的处理并运行在同一应用程序的不同实例上.(他们想要消费生产者推送的每条消息)

  1. 3 consumers are doing the same processing and running on different instance of same application under a load balancer.(They want to consume every message pushed by producer)

他们正在收听notification_queue";附有路由键"notify.#".

They are listening to "notification_queue" attached with routing key "notify.#".

剩余的第 4 个使用者正在执行与前 3 个使用者不同的处理,并在不同的服务器(不同应用程序)上运行.

Remaining 4th consumer is doing some different processing than first 3 consumers and running on different server(of different application).

它正在监听log_queue";附有路由键"notify.log.#".

It is listening to "log_queue" attached with routing key "notify.log.#".

RabbitMQ 是否会在前 3 个消费者中以循环方式分发消息(第 1 点)?

Will RabbitMQ distribute message in round robin fashion in first 3 consumers(in point 1)?

请帮忙.

推荐答案

确实如此,不管消费者的起源是什么.当我们在同一个队列上有多个消费者时,分配是循环的,你可以在这里的模拟器中尝试一下 http://tryrabbitmq.com/

Yes indeed , does not matter what is the point of a origin of consumer . When we have multiple consumers on the same queue then the distribution is round robin , you can try it out in the simulator here http://tryrabbitmq.com/

这篇关于RabbitMQ:使用单个队列进行主题交换的消息循环分发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆