spring下activemq的xml配置

<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns="http://www.springframework.org/schema/beans" xmlns:aop="http://www.springframework.org/schema/aop"
 xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
 xmlns:cache="http://www.springframework.org/schema/cache" xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans 
 http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
 http://www.springframework.org/schema/aop
 http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
 http://www.springframework.org/schema/context
 http://www.springframework.org/schema/context/spring-context-4.0.xsd
 http://www.springframework.org/schema/tx
 http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
 http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache-4.0.xsd">

  
 <bean id="pooledConnectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory" destroy-method="stop"> 
 <property name="connectionFactory"> 
 <bean class="org.apache.activemq.ActiveMQConnectionFactory"> 
 <property name="brokerURL" value="tcp://localhost:61616" /> 
 </bean> 
 </property> 
 </bean> 

 <!-- 连接工厂 -->
 <bean id="activeMQConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory"> 
 <property name="brokerURL" value="tcp://localhost:61616" /> 
 <!-- <property name="brokerURL" value="ws://localhost:61614" /> --> 
 </bean> 

 <!-- 配置消息目标 -->
 <bean id="queryDestination" class="org.apache.activemq.command.ActiveMQQueue">

 <constructor-arg index="0" value="greetings" /> 
 </bean> 

 <!-- 定义消息Destination -->
 <bean id="topicDestination" class="org.apache.activemq.command.ActiveMQTopic">
 <constructor-arg value="/topic/greetings"/>
 </bean>


 <!-- 消息模板 -->
 <bean id="queryJmsTemplate" class="org.springframework.jms.core.JmsTemplate"> 
 <property name="connectionFactory" ref="activeMQConnectionFactory" /> 
 <property name="defaultDestination" ref="queryDestination" /> 
 <property name="messageConverter"> 
 <bean class="org.springframework.jms.support.converter.SimpleMessageConverter" />
 </property> 
 </bean> 

 <!-- 消息发送者客户端 -->
 <bean id="topicJmsTemplate" class="org.springframework.jms.core.JmsTemplate">
 <property name="connectionFactory" ref="activeMQConnectionFactory" />
 <property name="defaultDestination" ref="topicDestination" />
 <property name="messageConverter"> 
 <bean class="org.springframework.jms.support.converter.SimpleMessageConverter" />
 </property> 

 <!-- 开启订阅模式 -->
 <property name="pubSubDomain" value="true"/>
 <property name="receiveTimeout" value="10000" />

 <!-- deliveryMode, priority, timeToLive 的开关要生效,必须配置为true,默认false-->
 <property name="explicitQosEnabled" value="true"/>

 <!-- 发送模式
 DeliveryMode.NON_PERSISTENT=1:非持久 ;
 DeliveryMode.PERSISTENT=2:持久
 -->
 <property name="deliveryMode" value="2"/>
 </bean>