<?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="connectionFactory" class="org.springframework.jms.connection.CachingConnectionFactory">
		<property name="targetConnectionFactory" ref="activeMqConnectionFactory"/>
		<property name="sessionCacheSize" value="100"/>
	</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="defaultMessageQueueListener" class="com.zheng.cms.job.jms.DefaultMessageQueueListener"/>
	<bean id="jmsContainer"  class="org.springframework.jms.listener.DefaultMessageListenerContainer">
		<property name="connectionFactory" ref="connectionFactory"/>
		<property name="destination" ref="defaultQueueDestination"/>
		<property name="messageListener" ref="defaultMessageQueueListener"/>
		<property name="sessionTransacted" value="true"/>
		<!--<property name="concurrency" value="4-10"/>-->
	</bean>

</beans>