applicationContext-jms.xml 1.9 KB
<?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:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="http://www.springframework.org/schema/beans 
        http://www.springframework.org/schema/beans/spring-beans-2.5.xsd 
        http://www.springframework.org/schema/context 
        http://www.springframework.org/schema/context/spring-context-2.5.xsd"
   >
    <context:component-scan base-package="org.com.sibu.orderHelper.activeMQ" />
    
   
	  
     <bean id="targetConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
        <property name="brokerURL" value="${MQ.url}"/>
  		<property name="userName" value="${MQ.UserName}"></property>
        <property name="password" value="${MQ.Password}"></property>
    </bean>
    
    <!-- Spring用于管理真正的ConnectionFactory的ConnectionFactory -->
    <bean id="connectionFactory" class="org.springframework.jms.connection.SingleConnectionFactory">
        <!-- 目标ConnectionFactory对应真实的可以产生JMS Connection的ConnectionFactory -->
        <property name="targetConnectionFactory" ref="targetConnectionFactory"/>
    </bean>
    
     <bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
        <!-- 这个connectionFactory对应的是我们定义的Spring提供的那个ConnectionFactory对象 -->
        <property name="connectionFactory" ref="connectionFactory"/>
    </bean>
    
    <bean id="sendMessageHome" class="org.com.sibu.orderHelper.activeMQ.util.SendMessageHone">
    	<property name="producerService" ref="producerService"></property>
    </bean> 
    
    
   
    <!-- 操作日志 -->
     <bean id="OPERATION_LOG_MESSAGE" class="org.apache.activemq.command.ActiveMQQueue">
        <constructor-arg value="OPERATION_LOG_MESSAGE"/>
    </bean>

    
</beans>