当RabbitMQ在RabbitMQ文件中配置时,我正在尝试理解Spring代码。在接收方xml文件中,我有
<rabbit:queue id="springQueue" name="spring.queue" auto-delete="true" durable="false"/>
<rabbit:queue name="springQueue" auto-delete="true" durable="false"/>
<rabbit:listener-container connection-factory="connectionFactory">
<rabbit:listener queues="springQueue" ref="messageListener"/>
</rabbit:listener-container>
<bean id="messageListener" class="com.ndpar.spring.rabbitmq.MessageHandler"/>
<!-- Bindings -->
<rabbit:fanout-exchange name="amq.fanout">
<rabbit:bindings>
<rabbit:binding queue="springQueue"/>
</rabbit:bindings>
</rabbit:fanout-exchange>我的问题是-交换绑定到哪个队列??springQueue或spring.queue ??我的意思是,在标记-中,它指的是队列id还是队列名称??同样在标记中,属性‘queue’指的是队列id或队列名称??请帮帮忙。我查看了模式(xsd),但无法弄清楚。请帮帮忙。
发布于 2018-02-27 21:42:06
queues (在侦听器中)和queue (在绑定中)应该引用队列id属性。
在侦听器中,您可以在queue-names属性中使用队列名称,但绑定始终需要id。
https://stackoverflow.com/questions/49003579
复制相似问题