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.
category:
English
Deutsch 

Great summary.
BTW the jars need to go to $MULE_HOME/lib/opt (not optional, there is no such directory)
Why do you show the global endpoint here? The flow would be more consise if the endpoint declaration was just inlined.
Thanks for the hint. I just fixed it.
The example was taken from a project where the global endpoints and flows were defined in separate configuration files. Most of the endpoints were used in several flows and therefore they were referenced.
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
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.
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.
Dear Hassan,
I added a section that describes how to declare the needed XML namespace.
HTH,
Tobias
Did you connect SIBus (websphere Service Integration bus) from Mule, if you would you please provide the configuration
We used a plain WebSphereMQ server as a JMS server. I don’t know about SIBus or how to integrate that into Mule.
I would like to add that by using com.ibm.mq.jms.MQXAQueueConnectionFactory the connector will be able to handle XA transactions.
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.
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.