0
votes

I am trying to understand Spring RabbitMQ codes when RabbitMQ is configured in XML files. In the receiver xml file, I have

<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>

My question is - To which queue is the exchange bound to?? springQueue or spring.queue ?? I mean to ask, in the tag - , is it referring to queue id or queue name ?? also in the tag , the attribute 'queues' refers to queue id or queue name?? Please help. I looked at the schemas (xsd) but couldn't get clarity. Please help.

1

1 Answers

1
votes

queues (in the listener) and queue (in the binding) should refer to the queue id attribute.

In the listener, you can use the queue name in the queue-names attribute but the binding always needs the id.