JBoss HornetQ setup and Spring
rm0han Jul 31, 2015 10:30 AMI am changing my exisiting Spring JMS configuration to use HornetQ in Jboss so that I can execute Arquillian tests.
My HornetQ configuration is this.
<?xml version="1.0" encoding="UTF-8"?>
<messaging-deployment xmlns="urn:jboss:messaging-deployment:1.0">
<hornetq-server>
<connection-factory name="ConnectionFactory">
<connectors>
<connector-ref connector-name="in-vm"/>
</connectors>
<entries>
<entry name="ConnectionFactory"/>
</entries>
<consumer-window-size>0</consumer-window-size>
<retry-interval>1000</retry-interval>
<retry-interval-multiplier>1.5</retry-interval-multiplier>
<max-retry-interval>60000</max-retry-interval>
<reconnect-attempts>1000</reconnect-attempts>
</connection-factory>
<jms-destinations>
<jms-queue name="test">
<entry name="queue/putplan" />
<entry name="java:jboss/exported/jms/queue/test" />
</jms-queue>
<jms-queue name="test4
">
<entry name="devicePermissionsCheckReqQueue" />
<entry name="java:jboss/exported/jms/queue/test4" />
</jms-queue>
</jms-destinations>
</hornetq-server>
</messaging-deployment>
My Spring conf. is this. I have added comments to show problems faced.
<bean id="jmsQueueConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="java:/jboss/exported/jms/ConnectionFactory" />
<property name="lookupOnStartup" value="false"/>
<property name="proxyInterface" value="javax.jms.ConnectionFactory"/>
</bean>
<!-- I want to inject this template. Doesn't throw errors -->
<bean id="regResponseJmsTemplate" class="org.springframework.jms.core.JmsTemplate">
<constructor-arg name="connectionFactory" ref="jmsQueueConnectionFactory"></constructor-arg>
</bean>
<!-- How do I refer a queue here from the HornetQ configuration ? This doesn't seem to be right. My HornetQ is embedded in JBoss and my EAR is deployed-->
<!-- Throws errors. EAR with Arquillian tests are deployed in JBoss -->
<bean id="defaultDestination" class="org.hornetq.jms.client.HornetQQueue">
<constructor-arg index="0" value="accountPermissiondestinationQueue"/>
</bean>
<bean id="Listener"
class="org.springframework.jms.listener.DefaultMessageListenerContainer">
<property name="connectionFactory" ref="jmsQueueConnectionFactory" />
<property name="destination" ref="accountPermissiondestinationQueue" />
<property name="messageListener" ref="permissionListener" />
</bean>
Can anyone point out the right approach ?
Thanks,
Mohan