简体   繁体   English

RabbitMQ:直接交换与扇出交换

[英]RabbitMQ: Direct Exchange vs Fanout Exchange

I've been trying to use RabbitMQ and faced the following question (very similar to this one: Topic Exchange vs Direct Exchange in RabbitMQ ). 我一直在尝试使用RabbitMQ并遇到以下问题(与这一问题非常相似: RabbitMQ中的主题交换与直接交换 )。

I need to intensively broadcast something around 800 types of messages (so there will be many consumers for each message type) and I wonder which of the following approaches is better: 我需要密集地广播约800种消息类型(因此每种消息类型会有很多使用者),我想知道以下哪种方法更好:

  1. Create one direct exchange where messages will be sent with a routing key (message type name) and every consumer will be connected to it with a temporary queue bound with a corresponding routing key. 创建一个直接交换,其中将使用路由密钥(消息类型名称)发送消息,并且每个消费者都将通过绑定有相应路由密钥的临时队列与之连接。 (Because there is no complex routing keys like 'key1.key2.*' I decided not to use topic exchange). (因为没有像'key1.key2。*'这样的复杂路由键,所以我决定不使用主题交换)。

  2. Create a fanout exchange for each message type. 为每种消息类型创建一个扇出交换。

I've read very good article about performance issues - ROUTING TOPOLOGIES FOR PERFORMANCE AND SCALABILITY WITH RABBITMQ but I'm new to RabbitMQ and just want to get some more best practices advice. 我已经阅读了有关性能问题的非常不错的文章- 使用RABBITMQ路由拓扑以提高性能和可扩展性,但是我是RabbitMQ的新手,只想获取更多最佳实践建议。

使用路由键,它将更简单,更有效:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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