Spring实现IBMMQ的JMS消息发布/订阅模式

<?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:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd">

<!--  IBM的mq配置 ConnectionFactory-->
   <bean id="mqConnectionFactoryTarget" class="com.ibm.mq.jms.MQTopicConnectionFactory">
   <!--   -->
<property name="transportType">
<util:constant static-field="com.ibm.mq.jms.JMSC.MQJMS_TP_CLIENT_MQ_TCPIP" />
</property>

<property name="queueManager" value="${ibm_queueManager}" />
<property name="hostName"     value="${ibm_hostName}" />
<property name="port"         value="${ibm_port}" />
</bean>


<bean id="mqConnectionFactory"
class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter">
<property name="targetConnectionFactory" ref="mqConnectionFactoryTarget" />
<property name="username" value=" " />
<property name="password" value=" " />
</bean>


<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate"  >
   <property name="connectionFactory" ref="mqConnectionFactory" />

</bean>

<!-- Topic定义 -->
<bean id="notifyTopic" class="com.ibm.mq.jms.MQTopic">
<constructor-arg value="${ibm_topicName}" />
</bean>
</beans>


<!-- 异步接收Topic消息Container 
<property name="connectionFactory" ref="jmsFactory" />-->
<bean id="jmsContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer" lazy-init="false">
<property name="connectionFactory" ref="mqConnectionFactory" />
<property name="destination" ref="notifyTopic" />
<property name="messageListener" ref="notifyTopicListener" />
</bean>

<!-- 异步接收Topic消息处理类 -->
<bean id="notifyTopicListener" class="com.liuyu.examples.jms.NotifyTopicListener" />

你可能感兴趣的:(spring)