|
|
@@ -0,0 +1,41 @@
|
|
|
+<?xml version="1.0" encoding="UTF-8"?>
|
|
|
+<beans xmlns="http://www.springframework.org/schema/beans"
|
|
|
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
|
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
|
|
|
+ http://www.springframework.org/schema/beans/spring-beans-3.2.xsd"
|
|
|
+ default-autowire="byName">
|
|
|
+
|
|
|
+ <!-- 连接工厂 -->
|
|
|
+ <bean id="activeMqConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
|
|
|
+ <property name="brokerURL" value="${AvtiveMQ.brokerURL}"/>
|
|
|
+ </bean>
|
|
|
+ <bean id="pooledConnectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory">
|
|
|
+ <property name="connectionFactory" ref="activeMqConnectionFactory"/>
|
|
|
+ <property name="maxConnections" value="10"/>
|
|
|
+ </bean>
|
|
|
+ <bean id="connectionFactory" class="org.springframework.jms.connection.SingleConnectionFactory">
|
|
|
+ <property name="targetConnectionFactory" ref="pooledConnectionFactory"/>
|
|
|
+ </bean>
|
|
|
+ <!-- 点对点队列 -->
|
|
|
+ <bean id="defaultQueueDestination" class="org.apache.activemq.command.ActiveMQQueue">
|
|
|
+ <constructor-arg index="0" value="com.zheng.cms.queue.default" />
|
|
|
+ </bean>
|
|
|
+ <!-- 一对多队列 -->
|
|
|
+ <!--
|
|
|
+ <bean id="defaultTopicDestination" class="org.apache.activemq.command.ActiveMQTopic">
|
|
|
+ <constructor-arg index="0" value="com.zheng.cms.topic.default" />
|
|
|
+ </bean>
|
|
|
+ -->
|
|
|
+
|
|
|
+ <!-- 生产者 -->
|
|
|
+ <bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
|
|
|
+ <property name="connectionFactory" ref="connectionFactory"/>
|
|
|
+ </bean>
|
|
|
+ <!-- 消费者 -->
|
|
|
+ <bean id="defaultQueueMessageListener" class="com.zheng.cms.jms.defaultQueueMessageListener"/>
|
|
|
+ <bean id="jmsContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
|
|
|
+ <property name="connectionFactory" ref="connectionFactory" />
|
|
|
+ <property name="destination" ref="defaultQueueDestination" />
|
|
|
+ <property name="messageListener" ref="defaultQueueMessageListener" />
|
|
|
+ </bean>
|
|
|
+</beans>
|