2013/03/22 - [OpenSource/Spring] - HornetQ, JMS Client using Springframework and Maven
2013/03/22 - [Was/JBOSS] - JBoss의 미들웨어에 Hornetq를 설치
내가 했던 작업은 이러하다.
1. JBoss에 Hornetq를 설치(Hornetq install을 구해 ant로 빌드 ant -f build.xml
2. JBoss에 설치 된 Hornetq의 xml 설정을 추가(Queue, Topic, ConnectionFactory등)
3. Spring에 Context 파일을 추가(jms template사용)
이러한 작업을 통해서..sample소스까지도 무리 없이 돌아간다.
하지만..어떻게 돌아가는지 궁금하다...그래서 찾아보았다^-^good~
Listing 1 shows the configuration of the JMS template used for the example application.
(리스팅 1은 설정파일을 보여준다. JMS 템블릿의 예제로 사용되어진)
The listing is an extract from the spring-mqseries-jms.xml file (see Download).
(리스팅은 발췌했다 spring-mqseries-jms.xml 파일에서~)
jms template 설정파일은 아래와 같다!
Listing 1. JMS template configuration
<!-- JMS Queue Template --> <bean id="jmsQueueTemplate" class="org.springframework.jms.core.JmsTemplate102"> <property name="connectionFactory"> <ref bean="jmsQueueConnectionFactory"/> </property> <property name="destinationResolver"> <ref bean="jmsDestinationResolver"/> </property> <property name="pubSubDomain"> <value>false</value> </property> <property name="receiveTimeout"> <value>20000</value> </property> </bean> |
The jmsQueueTemplate
bean is wired with a JMS connection factory and a JMS destination resolver for resolving destination queue names supplied by JMS clients through JNDI. The connectionFactory
property specifies how to get a connection to a JMS provider. In the case of the example, Listing 2 shows how to retrieve the connection factory from JNDI.
Listing 2. Configuring a JMS connection factory through JNDI
|
As you can see, the JndiObjectFactoryBean
is wired to an internalJmsQueueConnectionFactory
. The JndiObjectFactoryBean
uses the JndiTemplate
property for JNDI lookup. Spring will look up the connection factory in JNDI using the environment property and initial context specified in the JndiTemplate
. Listing 3 shows the configuration of the JndiTemplate
configuration bean.
Listing 3. JNDI template configuration for JNDI lookup
아래에서 커넥션 팩토리를 찾는다는 말이다~스프링은^_^good~ <bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate"> <property name="environment"> <props> <prop key="java.naming.factory.initial"> com.sun.jndi.fscontext.RefFSContextFactory </prop> <prop key="java.naming.provider.url"> file:/C:/JNDI-Directory // the provider URL </prop> </props> </property> </bean> |
The above configuration specifies the initial context factory as com.sun.jndi.fscontext.RefFSContextFactory
and the provider URL as the file-based file:/C:/JNDI-Directory for JNDI lookup. For the purpose of the example application,
the JNDI access will use the file-based FSContext
version (see Resources) configured for binding MQ queues to JNDI.
더 많은 내용은~참고자료!
http://www.ibm.com/developerworks/java/library/wa-spring4/index.html
참고!! Jms Template API(Spring 3.0.x)
http://static.springsource.org/spring/docs/3.0.x/api/org/springframework/jms/core/JmsTemplate.html
조금 더 detail 한 내용은 회사에 가서 소스와 함께 알아봐야겠다!!
일단 -끝-
'OpenSource > Spring' 카테고리의 다른 글
Bug (0) | 2013.06.21 |
---|---|
@Vaild 처리 시 주의 할 사항!! (0) | 2013.06.21 |
HornetQ, JMS Client using Springframework and Maven (0) | 2013.03.22 |
@XMLAccessorType, @XMLRootElement (0) | 2013.01.21 |
spring bean 등록 방법 (0) | 2013.01.04 |