RabbitMQ:不同交换中的类似队列
我可以有两个具有相同名称和相同路由密钥的队列,但每个队列都绑定到另一个交换机吗?
Can I have two queues with the same name and same routingKey yet each bound to another exchange?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你不能这样做,除非这些队列位于不同的虚拟主机中。
You can't do that, unless those queues are in different vhosts.
您根本不能有两个同名的队列(如果它们位于不同的虚拟主机中,则可以,但我不认为这就是您所说的)。
但是,您可以将一个队列绑定到多个交换机,或者绑定到具有多个路由键的一台交换机。如果您的目标是让单个消费者从多个交换中获取消息,那么这就是您想要做的。
You can't have two queues with the same name at all, (well you can if they're in different virtual hosts but I don't think that's what you're talking about).
However, you can bind one queue to many exchanges, or to one exchange with many routing keys. If you're aiming to have a single consumer pick up messages from several exchanges, that's what you want to do.