1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <?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.0.xsd">
- <description>JMS简单应用配置</description>
- <!-- ActiveMQ 连接工厂 -->
- <bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
- <property name="brokerURL" value="${jms.broker_url}" />
- </bean>
- <!-- Spring Caching 连接工厂 -->
- <bean id="cachingConnectionFactory" class="org.springframework.jms.connection.CachingConnectionFactory">
- <property name="targetConnectionFactory" ref="connectionFactory" />
- <property name="sessionCacheSize" value="10" />
- </bean>
- <!-- Queue定义 -->
- <bean id="notifyQueue" class="org.apache.activemq.command.ActiveMQQueue">
- <constructor-arg value="q.notify" />
- </bean>
- <!-- Spring JMS Template -->
- <bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
- <property name="connectionFactory" ref="cachingConnectionFactory" />
- </bean>
- <!-- 使用Spring JmsTemplate的消息生产者 -->
- <bean id="notifyMessageProducer" class="com.pentair.showcase.jms.email.NotifyMessageProducer">
- <property name="jmsTemplate" ref="jmsTemplate" />
- <property name="notifyQueue" ref="notifyQueue" />
- </bean>
- <!-- 异步接收Queue消息Container -->
- <bean id="queueContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
- <property name="connectionFactory" ref="connectionFactory" />
- <property name="destination" ref="notifyQueue" />
- <property name="messageListener" ref="notifyMessageListener" />
- <property name="concurrentConsumers" value="10" />
- </bean>
- <!-- 异步接收消息处理类 -->
- <bean id="notifyMessageListener" class="com.pentair.showcase.jms.email.NotifyMessageListener" />
- </beans>
|