WebSphereMQ Integration using Mule ESB Community Edition

10 Comments

Mule ESB is an open source implementation of an enterprise service bus. In contrast to the free Community Edition, Mule’s commercial Enterprise Edition provides integration of WebSphereMQ servers out of the box. This article explains how to integrate a WebSphereMQ server as a JMS provider by means of the Community Edition.

First, add the following JARs holding the WebSphereMQ client API to Mule’s classpath:

  • com.ibm.mq.jar
  • com.ibm.mqjms.jar
  • dbhcore.jar

These JARs are provided with the installation of your WebSphereMQ server. Alternatively, they can be taken from the free WebSphereMQ client distribution. Note that the client distribution does not support XA transactions. Copy these JARs to

$MULE_HOME/lib/opt

To configure the connection to your WebSphereMQ system, you need to to know the following parameters:

– IP/ host name
– TCP port number
– Name of the Queue manager
– Name of the MQ channel
– User / Password

The Mule JMS connector is set up like this:

<jms:connector
   name="WebsphereMQConnector"
   connectionFactory-ref="MQConnectionFactory"
   specification="1.0.2b"
   username="mquser"
   password="password"
   numberOfConsumers="1"/>
<spring:bean
   id="MQConnectionFactory"
   class="com.ibm.mq.jms.MQQueueConnectionFactory">
   <spring:property name="transportType" value="1"/>
   <spring:property name="hostName" value="localhost"/>
   <spring:property name="port" value="1414"/>
   <spring:property name="channel" value="MY.CHANNEL"/>
   <spring:property name="queueManager" value="MY.QM"/>
</spring:bean>

To use the namespaces “jms” and “spring” you have to declare them in the root element of your mule-config.xml. Assuming you are using Mule 3.0, it may look like this:

<mule xmlns="http://www.mulesoft.org/schema/mule/core"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:spring="http://www.springframework.org/schema/beans"
       xmlns:jms="http://www.mulesoft.org/schema/mule/jms"
    xsi:schemaLocation="
       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
       http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.0/mule.xsd
       http://www.mulesoft.org/schema/mule/jms http://www.mulesoft.org/schema/mule/jms/3.0/mule-jms.xsd">

Having done this, the WebSphereMQConnector can be used to define JMS endpoints, e.g.

<endpoint 
   name="MyInQueue"   
   address="jms://queue:MY.QUEUE.IN"
   connector-ref="WebsphereMQConnector"/>
...
<flow id="MyFlow">
   <inbound-endpoint ref="MyInQueue" />
   ...
</flow>

JMS consumers need at least the GET, INQ and BROWSER privileges for queues they want to read from. A detailed explanation is given here. JMS producers need the PUT privilege.

Conclusion: as long as your queues do not partcipate in XA transactions, the free Community Edition of Mule ESB is sufficient to integrate a WebSphereMQ server as an external JMS provider.

Author

Tobias Trelle

Tobias Trelle

Senior IT Consultant

Share on FacebookGoogle+Share on LinkedInTweet about this on TwitterShare on RedditDigg thisShare on StumbleUpon

Kommentare

  • August 4, 2011 von Hassan Hammoud

    Thanks for this post. It’s very helpful. But can you please tell us what advantages do we get by using the Mule MQ connector of the EE version in comparison to the IBM connector? Thanks

    • Tobias Trelle

      Dear Hassan,

      my solution was applied to the community edition of Mule. I can’t say anything about the WebSphere connector of the enterprise edition of Mule because I don’t use it.

      • August 5, 2011 von Hassan Hammoud

        Thanks Tobias,

        I have another question though. Few documents are available for the mq client integration I am having a problem with xmlns and xsd to use to validate the jms:connector tag.

  • Did you connect SIBus (websphere Service Integration bus) from Mule, if you would you please provide the configuration

  • November 17, 2011 von Hassan Hammoud

    I would like to add that by using com.ibm.mq.jms.MQXAQueueConnectionFactory the connector will be able to handle XA transactions.

  • March 9, 2012 von john_mk

    I needed to add “com.ibm.mq.jmqi.jar” to the class path because of a class loading error. Otherwise the above seems to work.

    I´m using the jar´s from MQ Client version 7.0.1.3

    As a general comment on jms versus the native WMQ connector (as provided with Mule EE) is that you will typically not have access to all properties in the MQ Message header when you use a (the IBM) jms api.

    • Tobias Trelle

      I used a client version 6.x, maybe they moved some of the classes between the jars in version 7.

      Of course you are right w/ the MQ headers. The raw MQI API in general is much broader than the standard JMS API.

  • October 10, 2013 von Enrique

    I need to setup these properties in the message:

    MQMD-FORMAT
    MQMD-APPLIDENTITYDATA

    I tried this:

    but it seems that is not working.

    Any idea?

    Thanks in advance

Comment

Your email address will not be published. Required fields are marked *