I know it is supposed to be easy, but all samples for creating topics with Spring are failing for me. As an example, my latest context below. The producer (I changed it so much, so do not bother that the producer has also an ID "xyz_listener") is sending message to the proper jms.productT topic, but my listener is always registering for a queue named productT.
For routing the message I also cheked on debug my JndiDestinationResolver working fine with Topic.class. So why should Spring register a listener on DefaultMessageListenerContainer pointing to a Queue.class?
Can anyone see my config mistake?
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jms="http://www.springframework.org/schema/jms" xmlns:amq="http://activemq.apache.org/schema/core"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schem...ring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schem...ng-context.xsd
http://www.springframework.org/schema/jms
http://www.springframework.org/schem...spring-jms.xsd
http://activemq.apache.org/schema/core
http://activemq.apache.org/schema/core/activemq-core.xsd">
<bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
<property name="environment">
<props>
<prop key="java.naming.factory.initial">
org.apache.activemq.jndi.ActiveMQInitialContextFac tory
</prop>
<prop key="connection.TopicAC.brokerURL">tcp://localhost:61616</prop>
<prop key="java.naming.provider.url">tcp://localhost:61616</prop>
<prop key="java.naming.security.principal">system</prop>
<prop key="java.naming.security.credentials">manager</prop>
<prop key="connectionFactoryNames">TopicAC</prop>
<prop key="topic.productT">jms.productT</prop>
</props>
</property>
</bean>
<bean id="jndiTopicConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryB ean">
<property name="jndiTemplate" ref="jndiTemplate" />
<property name="jndiName" value="TopicAC" />
</bean>
<bean id="topicConnectionFactory"
class="org.springframework.jms.connection.CachingC onnectionFactory">
<property name="targetConnectionFactory" ref="jndiTopicConnectionFactory" />
<property name="sessionCacheSize" value="1" />
</bean>
<bean id="destinationResolver"
class="org.springframework.jms.support.destination .JndiDestinationResolver">
<property name="jndiTemplate" ref="jndiTemplate" />
<property name="cache" value="true" />
<property name="fallbackToDynamicDestination" value="false" />
</bean>
<!-- <bean id="productT" class="org.apache.activemq.command.ActiveMQTopic"> -->
<!-- <constructor-arg value="jms.productT" /> -->
<!-- </bean> -->
<bean id="jmsTopicTemplate" class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory" ref="topicConnectionFactory" />
<property name="destinationResolver" ref="destinationResolver" />
<property name="pubSubDomain" value="true" />
</bean>
<bean id="productListener" class="com.ypg.jms.server.ProductProcessor">
<property name="connectionFactory" ref="topicConnectionFactory" />
<property name="messageT" ref="jmsTopicTemplate" />
<property name="topicName" value="productT" />
</bean>
<bean id="websiteListener" class="com.ypg.jms.server.WebsiteListener" />
<bean id="campaignListener" class="com.ypg.jms.server.CampaignListener" />
<bean id="jmsContainer"
class="org.springframework.jms.listener.DefaultMes sageListenerContainer">
<property name="connectionFactory" ref="topicConnectionFactory" />
<!-- <property name="destinationName" ref="productT" /> -->
<property name="destinationName" value="productT" />
<property name="messageListener" ref="websiteListener" />
</bean>
</beans>


="http://www.springframework.org/schema/p"
Reply With Quote
