[英]why rabbitmq fanout exchange only one subscribe can be received message?
I created a rebbitmq fanout exchange example integration spring,but just only one subscribe can received message ,why?flowing is my configuration: publish configuration 我创建了一个rebbitmq扇出交换示例集成弹簧,但是只有一个订阅可以接收消息,为什么?流是我的配置:发布配置
<rabbit:connection-factory id="connectionFactory" username="dev" password="dev" host="localhost" />
<rabbit:template id="template" connection-factory="connectionFactory" reply-timeout="2000" exchange="2remoting.exchange" />
<rabbit:admin connection-factory="connectionFactory" />
<rabbit:queue name="remoting.queue1" />
<rabbit:fanout-exchange name="2remoting.exchange" >
<rabbit:bindings>
<rabbit:binding queue="remoting.queue1"/>
</rabbit:bindings>
</rabbit:fanout-exchange>
subscribe configuration 订阅配置
<bean id="service" class="com.hzins.bsp.dev.TestServiceImpl" />
<rabbit:connection-factory id="connectionFactory" username="dev" password="dev" host="localhost" />
<rabbit:template id="template" connection-factory="connectionFactory" />
<rabbit:queue name="remoting.queue1" />
<rabbit:listener-container connection-factory="connectionFactory">
<rabbit:listener ref="listener" queue-names="remoting.queue1" />
<rabbit:listener ref="listener" queue-names="remoting.queue1" />
</rabbit:listener-container>
No, you misunderstood the fanout exchange
definition. 不,您误解了
fanout exchange
定义。 It puts the message to all binded queues., but not to subscribes for those queues. 它将消息放入所有绑定的队列中,但不订阅这些队列。
It does not have value how much subscribers (listeners) you have for the same queue. 它不具有相同队列中有多少订户(侦听器)的值。 They are just concurrent consumers and only the one of them will receive a message from the queue.
他们只是并发的使用者,只有其中一个会从队列中接收消息。
Please, read more RabbitMQ docs. 请阅读更多RabbitMQ文档。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.