I have a HornetQ server which has topic and queue's. I am not aware of the config on the other side but the way I connect to the Queue is:
<bean id="connectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiTemplate" ref ="jndiTemplate"/>
<property name="jndiName" value="ConnectionFactory"/>
</bean>
<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory" ref="connectionFactory"/>
<property name="defaultDestination" ref="destination"/>
<property name="pubSubDomain" value="false"/>
<property name="deliveryPersistent" value="true"/>
<property name="deliveryMode" value="2"/>
</bean>
<bean id="destination" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiTemplate" ref="jndiTemplate"/>
<property name="jndiName" value="QUEUE_NAME"/>
</bean>
<!-- Listener Asynchronous -->
<bean id="queueListener" class="com.my.queueListener"/>
<jms:listener-container concurrency="5-10">
<jms:listener destination="QUEUE_NAME" ref="queueListener"/>
</jms:listener-container>
I had set the pubSubDomain
to true
and it worked (strange but true). Anyhow now I want to connect to a topic. I set the pubSubDomain
as true
and still it gives me an error saying
WARNING: Setup of JMS message listener invoker failed for destination 'Activate_NTD' - trying to recover. Cause: There is no queue with name TOPIC_NAME
I know HornetQ behaves a bit differently as specified here:
exact example for JMS Topic in HornetQ
but I am unable to figure out what to do and how to get this working.
Set the destination-type
on the container that defaults to queue, something like
<jms:listener-container destination-type="topic" concurrency="5-10">
<jms:listener destination="TOPIC_NAME" ref="topicListener"/>
</jms:listener-container>