Back to Blog Archive

Websphere MQ and Mule

Posted on: April 15, 2015

Websphere MQ (WMQ) is a fairly widely used message queue. As described in DZone’s 2014 enterprise integration guide, occupying 8% of the global market share.

In this blog post we use WMQ to send and receive messages from a Mule application. Using the WMQ connector in Mule requires an enterprise license, however this may be tested either inside AnyPoint Studio or the trial version of Mule EE. The example below has been tested with Mule EE version 3.6.1 (trial version available here) and WMQ (trial version available here).

To begin with, we need to configure a WMQ message broker. We use the Websphere MQ explorer tool in Windows 7. After installing with default settings throughout, we need to configure a couple of items inside WMQ:

1) Adding a Queue Manager: Right click on Queue Managers -> New Queue (go with the suggested options throughout). In the screen shot below we name the queue manager “QM1”:


2) Creating a Queue: Right click Queue under the newly created Queue Manager -> New Local Queue (go with the suggested options throughout). In the screen shot below we create a queue named “REQUEST.QUEUE”:


3) Deleting the default channel: Under your Queue Manager-> Channels -> Channel Authentication Records -> R click on the first row of Channel Profile -> Delete. Note: this step is only required if you would like to use your own channel.

4) Adding a new channel: R click Channels -> New Channel -> Server-connection channel. In the screenshot below we create a channel named “SYSTEM.ADMIN.SVRCONN” (you may need to enable view for system objects to see this):


Next we create a Mule application to both send and receive a message from the queue named “REQUEST.QUEUE” hosted in WMQ. An additional step is needed to copy the relevant WMQ Java libraries provided with the WMQ installation into the Mule server, go here for more details on this. The snippet below shows how to configure the WMQ connector in Mule:

The value used for port number may be determined from the default TCP listener inside the newly created queue manager. The queue manager name is the same as we specified in the MQ explorer. With a default installation, credentials must pertain to the user which created the MQ explorer installation. The remaining connector parameters are described here.

The code snippet below shows a simple Mule flow which accepts messages on an HTTP listener and dispatches these to the “REQUEST.QUEUE”:

The snippet below shows how to consume messages from the “REQUEST.QUEUE”:

Finally, the following is a the stack trace produced by the application described above:


One Comment for “Websphere MQ and Mule”

  1. Manish Yadav says:

    Nice Information..Could You please tell me How to access Header property of WMQ??


Contact Us

Ricston Ltd.
Triq G.F. Agius De Soldanis,
Birkirkara, BKR 4850,
MT: +356 2133 4457
UK: +44 (0)2071935107

Send our experts a message

Need Help?
Ask our Experts!