Spring Integration with IBM MQ Series

Being a newbie when it comes to Spring integration, and so he had some questions. I am trying to integrate Spring integration with the MQ Series and I believe that all my IBM MQ records (Q Connection Factory and Queue) should go inside my applicationcontext.xml file. I have an application file for implementing ActiveMQ, and I just wanted to find out exactly how the IBM MQ records in the App Contest file would look like. Questions -

  • Do I need to have the MQ Series installed on the same machine where I am running the Spring application.
    1. I believe not, what should be the entries for the QueueConnectionFactory and Destination attributes in the ApplicationContext file. providing some poc examples will help me a lot.

Thanks in advance.

+5
source share
1 answer

You can create beans as follows

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>
+3
source

All Articles