与IBM MQ系列的Spring集成 [英] Spring Integration with IBM MQ Series

查看:96
本文介绍了与IBM MQ系列的Spring集成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是关于Spring集成的新手,所以对此有一些疑问. 我正在尝试将Spring Integration与MQ Series集成在一起,并认为我所有的IBM MQ(Q连接工厂和队列)条目都应放在我的applicationcontext.xml文件中. 我有用于ActiveMQ实现的applicationcontext文件,只是想知道App Contest文件中特定于IBM MQ的条目将是什么样子.问题是-

Am novice when it comes to Spring integration and so had some questions around it. Am trying to integrate Spring Integration with the MQ Series and believe that all my IBM MQ(Q Connection Factory and Queue) entries should be going inside my applicationcontext.xml file. I have the applicationcontext file for ActiveMQ Implementation and just wanted to know what exactly an IBM MQ specific entries in App Contest file will look like. Questions are -

  1. 我需要在与我相同的机器上安装MQ系列吗? 正在运行我的Spring应用程序.
  1. Do I need to have an MQ Series installed on the same machine where I am running my Spring Application.
  1. 我假设不是,那么QueueConnectionFactory和Destination属性的条目应该是什么 在ApplicationContext文件中. 提供一些示例poc将对我有很大帮助.
  1. I presume not, then what should be the entries for QueueConnectionFactory and Destination attributes in the ApplicationContext file. providing some sample poc's will help me lot.

谢谢.

推荐答案

您可以创建像这样的bean

You can create beans like this

jms.transportType=1
jms.queueManager=YOUR_QUEUE_MANAGER
jms.hostName=YOUR_HOSTNAME
jms.port=1321

jms.channel=YOUR_CHANNEL
jms.receiver.queue.name=YOUR_QUEUE
jms.username=
jms.alias=
jms.mq.connection.factory=jmsConnectionFactory
jms.mq.receiver.queue=receiverQueue

<bean id="jmsConnectionFactory" class="com.ibm.mq.jms.MQQueueConnectionFactory">
    <property name="transportType" value="${jms.transportType}"/>
    <property name="queueManager" value="${jms.queueManager}"/>
    <property name="hostName" value="${jms.hostName}"/>
    <property name="port" value="${jms.port}" />
    <property name="channel" value="${jms.channel}"/>
</bean>
<bean id="secureJmsConnectionAdapter" class="yourpackages.SecureJMSConnectionAdapter">
    <property name="targetConnectionFactory" ref="${jms.mq.connection.factory}" />
    <property name="userName" value="${jms.username}"/>
    <property name="pwdAlias" value="${jms.alias}"/>
</bean>

<bean id="receiverQueue" class="com.ibm.mq.jms.MQQueue">
    <constructor-arg index="0" value="${jms.queueManager}"/>
    <constructor-arg index="1" value="${jms.receiver.queue.name}"/>
</bean>

<bean id="receiverJMSTemplate" class="org.springframework.jms.core.JmsTemplate">
    <property name="connectionFactory" ref="secureJmsConnectionAdapter" />
    <property name="pubSubDomain" value="false"/>
    <property name="defaultDestination" ref="${jms.mq.receiver.queue}"/>
    <property name="receiveTimeout" value="30000"/>
</bean>


<bean class="org.springframework.jms.listener.SimpleMessageListenerContainer">
    <property name="connectionFactory" ref="secureJmsConnectionAdapter" />
    <property name="destinationName" value="${jms.receiver.queue.name}" />
    <property name="messageListener" ref="mQListener" />
</bean>

这篇关于与IBM MQ系列的Spring集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆