简体   繁体   English

为什么rabbitmq扇出交换只能收到一个订阅消息?

[英]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.

相关问题 仅将消息发布到RabbitMQ Fanout交换(java)中的一个队列中 - Message only gets published to one queue in a RabbitMQ Fanout exchange (java) 通过Spring发送和接收RabbitMQ扇出交换 - Send and receive on RabbitMQ fanout exchange via Spring spring Rabbitmq获得对扇出消息的所有回复 - spring rabbitmq get all replies to a fanout message 配置Spring Integration聚合器以合并RabbitMq扇出交换的响应 - Configuring a Spring Integration aggregator to combine responses from a RabbitMq fanout exchange 如何使用Spring Boot通过扇出交换在RabbitMQ上发布消息 - How to publish messages on RabbitMQ with fanout exchange using Spring Boot 一个队列与同一消息的多个Exchange绑定时的RabbitMQ行为 - RabbitMQ behavior when One Queue binded with Multiple Exchange for Same message 确保至少一位消费者收到在主题交流上发布的消息 - Making sure a message published on a topic exchange is received by at least one consumer RabbitMQ 主题交换消息排序 - RabbitMQ topic exchange message ordering 带有Fanout Exchange的Stomp Websocket - Stomp Websocket with Fanout Exchange JMS是否可以保证队列中的消息一次只能由一个接收者实例接收? - Can JMS guarantee that a message in the queue can received by only one instance of receiver at a time?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM