The jms:listener element: hardcoded queue name

I thought I’d try using Spring’s jms: namespace to define my DefaultMessageListener container.  So I changed this:

<bean id=”jmsContainer” class=”org.springframework.jms.listener.DefaultMessageListenerContainer”>
<property name=”connectionFactory” ref=”queueConnectionFactory” />
<property name=”destination” ref=”queue” />
<property name=”messageListener” ref=”messageListener” />
<property name=”transactionManager” ref=”transactionManager” />
</bean>

to this:

<jms:listener-container connection-factory=”queueConnectionFactory” transaction-manager=”transactionManager”>

<jms:listener destination=”queue” ref=”messageListener” />

</jms:listener-container>

(the queue bean was defined this way:

<amq:queue id=”queue” physicalName=”gloriousTest.Queue” />
)

But now when I deployed my .war project, ActiveMQ had a queue named “queue”, and no consumers were listening to the gloriousTest.Queue queue.

As it turns out, the jms:listener element’s destination attribute refers to a physical queue name — it’s not a bean reference.  So I guess if I were going to use the jms:listener element I would need to hardcode gloriousTest.Queue there.  I’m not ready to do that at this point, so I think I’m going to revert back to the plain old <bean> element usage for my DefaultMessageListenerContainer.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.