OpenSource/Spring
HornetQ, JMS Client using Springframework and Maven
태하팍
2013. 3. 22. 17:58
반응형
spring에서 JMS > HornetQ를 쓸려고 찾아보다 보니..
http://www.javacodegeeks.com/2010/06/spring-3-hornetq-21-integration.html
요런 튜토리얼이 있었고 거기에는..
요런것들이 필요하다~~라고 되어있었지만..현재 프로젝트는 메이븐 프로젝트였다..
다시 찾아봤더니..아래에 좋은 사이트를 발견하였다^^
외국인 친구 땡큐!
펌] http://www.future-edge.nl/blog/hornetq-jms-client-using-spring-and-maven/
I’ve just been working getting working in our project. We are using Spring and Maven.
Here is an example to get it working:
Maven dependency configuration:
<!-- JMS --> <dependency> <groupId>javax.jms</groupId> <artifactId>jms-api</artifactId> <version>1.1-rev-1</version> </dependency> <!-- HornetQ --> <dependency> <groupId>org.hornetq</groupId> <artifactId>hornetq-core-client</artifactId> <version>2.2.18.Final</version> </dependency> <dependency> <groupId>org.hornetq</groupId> <artifactId>hornetq-jms-client</artifactId> <version>2.2.18.Final</version> </dependency> <dependency> <groupId>org.jboss.netty</groupId> <artifactId>netty</artifactId> <version>3.2.7.Final</version> </dependency>
Note you *DON’T* need the hornetq-transports dependency. There is a lot of old ‘help’ with only seems to work using version 2.0.0.GA with did use that JAR.
Spring configuration:
<bean name="qConnectionFactory" class="org.hornetq.jms.client.HornetQXAConnectionFactory" > <constructor-arg value="false" /> <constructor-arg> <bean name="transportConfiguration" class="org.hornetq.api.core.TransportConfiguration"> <constructor-arg value="org.hornetq.core.remoting.impl.netty.NettyConnectorFactory" /> <constructor-arg> <map key-type="java.lang.String" value-type="java.lang.Object"> <entry key="host" value="127.0.0.1" /> <entry key="port" value="5445" /> </map> </constructor-arg> </bean> </constructor-arg> </bean> <bean name="theQueue" class="org.hornetq.jms.client.HornetQQueue"> <constructor-arg value="someName" /> </bean> <bean name="jmsTemplate" class="org.springframework.jms.core.JmsTemplate"> <property name="connectionFactory" ref="qConnectionFactory" /> <property name="defaultDestinationName" value="theQueue" /> </bean>
Note the class used to configure the netty connector factory. That’s what is different between the 2.2.18 version (it’s in the core now) and the 2.0.0.
반응형