user3344338 :
Here is a working sample using Spring MDP/Activation Spec for websphere MQ\n\nmdp-listener.xml\n\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE beans PUBLIC \"-//SPRING//DTD BEAN//EN\" \n \"http://www.springframework.org/dtd/spring-beans.dtd\">\n\n\n <bean id=\"messageListener\" class=\"com.rohid.samples.SpringMdp\" /> \n\n <bean class=\"org.springframework.jms.listener.endpoint.JmsMessageEndpointManager\">\n <property name=\"activationSpec\">\n <bean class=\"com.ibm.mq.connector.inbound.ActivationSpecImpl\">\n <property name=\"destinationType\" value=\"javax.jms.Queue\"/>\n <property name=\"destination\" value=\"QUEUE1\"/>\n <property name=\"hostName\" value=\"A.B.C\"/>\n <property name=\"queueManager\" value=\"QM_\"/>\n <property name=\"port\" value=\"1414\"/>\n <property name=\"channel\" value=\"SYSTEM.ADMIN.SVNNN\"/>\n <property name=\"transportType\" value=\"CLIENT\"/>\n <property name=\"userName\" value=\"abc\"/>\n <property name=\"password\" value=\"jabc\"/>\n </bean>\n </property>\n <property name=\"messageListener\" ref=\"messageListener\"/>\n <property name=\"resourceAdapter\" ref=\"myResourceAdapterBean\"/>\n </bean>\n\n <bean id=\"myResourceAdapterBean\" class =\"org.springframework.jca.support.ResourceAdapterFactoryBean\">\n <property name=\"resourceAdapter\">\n <bean class=\"com.ibm.mq.connector.ResourceAdapterImpl\">\n <property name=\"maxConnections\" value=\"50\"/>\n </bean>\n </property>\n <property name=\"workManager\">\n <bean class=\"org.springframework.jca.work.SimpleTaskWorkManager\"/>\n </property>\n </bean>\n</beans>\n\n\nweb.xml\n\n<context-param>\n <param-name>contextConfigLocation</param-name>\n <param-value>/WEB-INF/context/mdp-listener.xml</param-value>\n </context-param>\n\n<listener>\n <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>\n</listener>\n\n\nSpringMdp\n\n package com.rohid.samples;\n\n import javax.jms.JMSException;\n import javax.jms.Message;\n import javax.jms.MessageListener;\n import javax.jms.TextMessage;\n\n public class SpringMdp implements MessageListener {\n\n public void onMessage(Message message) {\n try {\n if(message instanceof TextMessage) {\n System.out.println(this + \" : \" + ((TextMessage) message).getText());\n }\n\n } catch (JMSException ex){\n throw new RuntimeException(ex);\n }\n }\n }\n\n\n'",
2014-02-24T23:31:52
Dwight Shih :
I just went through this myself. Start with the Spring Boot JMS Starter\nAdd a bean providing a MQQueueConnectionFactory\n@Configuration\n@EnableJms\npublic class MQConfiguration {\n @Bean\n public MQQueueConnectionFactory mqFactory()\n {\n MQQueueConnectionFactory factory = null;\n try {\n factory = new MQQueueConnectionFactory();\n factory.setHostName("localhost");\n factory.setPort(1414);\n factory.setQueueManager("QM.LOCAL");\n factory.setChannel("SYSTEM.DEF.SVRCONN");\n factory.setTransportType(JMSC.MQJMS_TP_CLIENT_MQ_TCPIP);\n }\n catch (JMSException e) {\n System.out.println(e);\n }\n return factory;\n }\n}\n\nRemove the dependency on org.apache.activemq / activemq-broker to make sure activemq doesn't sneak its way in.\nAdd dependencies on com.ibm.mqjms.jar, com.ibm.mq.jmqi.jar, dhbcore.jar\nRun",
2017-03-26T18:35:52
T.Rob :
These were written for WMQ V5.3 but mostly still apply. The things that have changed are more about the WMQ admin than the connectivity and config.\n\ndeveloperWorks: The Spring Series\n\nPlease be sure to include the versions of WMQ server and client on future posts because the details of the Java/JMS configuration differ. Also, be sure to use the version of the documentation that matches the version of WMQ client or server that you are working with.",
2013-01-25T14:19:41