7 min read

WebSphere MQ overview

WebSphere MQ formerly known as MQ Series is IBM’s enterprise messaging solution. In a nutshell, MQ provides the mechanisms for messaging both in point-to-point and publish-subscribe. However, it guarantees to deliver a message only once. This is important for critical business applications which implement messaging. An example of a critical system could be a banking payments system where messages contain messages pertaining to money transfer between banking systems, so guaranteeing delivery of a debit/credit is paramount in this context. Aside from guaranteed delivery, WMQ is often used for messaging between dissimilar systems and the WMQ software provides programming interfaces in most of the common languages, such as Java, C, C++, and so on. If you are using WebSphere, then it is common to find that WMQ is often used with WebSphere when WebSphere is hosting message-enabled applications. It is important that the WebSphere administrator understands how to configure WebSphere resources so that application can be coupled to the MQ queues.

Overview of WebSphere MQ example

To demonstrate messaging using WebSphere MQ, we are going to re-configure the previously deployed JMS Tester application so that it will use a connection factory which communicates with a queue on a WMQ queue manager as opposed to using the default provider which we demonstrated earlier.

Installing WebSphere MQ

Before we can install our demo messaging application, we will need to download and install WebSphere MQ 7.0. A free 90-day trial can be found at the following URL:


Click the download link as shown below.

WebSphere Application Server

You will be prompted to register as an IBM website user before you can download the WebSphere MQ Trial. Once you have registered and logged in, the download link above will take you to a page which lists download for different operating systems.

Select WebSphere MQ 7.0 90-day trial from the list of available options as shown below.

WebSphere Application Server

Click continue to go to the download page. You may be asked to fill out a questionnaire detailing why you are evaluating WebSphere MQ (WMQ). Fill out the question as you see fit and submit to move to the download page.

WebSphere Application Server

As shown above, make sure you use the IBM HTTP Download director as it will ensure that your download will resume, even if your Internet loses a connection.

If you do not have a high-speed Internet connection, you can try downloading a free 90-day trial of WebSphere MQ 7.0 overnight while you are asleep.

WebSphere Application Server

Download the trial to a temp folder, for example c:temp, on your local machine. The screenshot above shows how the IBM HTTP Downloader will prompt for a location where you want to download it to. Once the WMQ install file has been downloaded, you can then upload the file using an appropriate secure copy utility like Winscp to an appropriate folder like /apps/wmq_install on your Linux machine. Once you have the file uploaded to Linux, you can then decompress the file and run the installer to install WebSphere MQ.

Running the WMQ installer

Now that you have uploaded the WMQv700Trial-x86_linux.tar file on your Linux machine, and follow these steps:

  1. You can decompress the file using the following command:
    gunzip ./WMQv700Trial-x86_linux.tar.gz
  2. Then run the un-tar command:
    tar -xvf ./ WMQv700Trial-x86_linux.tar
  3. Before we can run the WMQ installations, we need to accept the license agreement by running the following command:
    ./mqlicense.sh –accept
  4. To run the WebSphere MQ installation, type the following commands:
    rpm -ivh MQSeriesRuntime-7.0.0-0.i386.rpm
    rpm -ivh MQSeriesServer-7.0.0-0.i386.rpm
    rpm -ivh MQSeriesSamples-7.0.0-0.i386.rpm
  5. As a result of running the MQSeriesServer installation, a new user called mqm was created. Before running any WMQ command, we need to switch to this user using the following command:
    su - mqm
  6. Then, we can run commands like the dspmqver command which can be run to check that WMQ was installed correctly. To check whether WMQ is installed, run the following command:

The result will be the following message as shown in the screenshot below:

WebSphere Application Server

Creating a queue manager

Before we can complete our WebSphere configuration, we need to create a WMQ queue manager and a queue, then we will use some MQ command line tools to put a test message on an MQ queue and get a message from an MQ queue.

  1. To create a new queue manager called TSTDADQ1, use the following command:
    crtmqm TSTDADQ1
  2. The result will be as shown in the image below.

    WebSphere Application Server

  3. We can now type the following command to list queue managers:
  4. The result of running the dspmq command is shown in the image below.

    WebSphere Application Server

  5. To start the queue manager (QM), type the following command:
  6. The result of starting the QM will be similar to the image below.

    WebSphere Application Server

  7. Now that we have successfully created a QM, we now need to add a queue called LQ.Test where we can put and get messages.
  8. To create a local queue on the TSTDADQ1 QM, type the following commands in order:
    runmqsc TSTDADQ1
  9. You are now running the MQ scripting command line, where you can issue MQ commands to configure the QM.
  10. To create the queue, type the following command and hit Enter:
    define qlocal(LQ.TEST)
  11. Then immediately type the following command:
  12. Hit Enter to complete the QM configuration, as shown by the following screenshot.

    WebSphere Application Server

You can use the following command to see if your LQ.TEST queue exists.

echo "dis QLOCAL(*)" | runmqsc TSTDADQ1 | grep -i test

You have now added a local queue called Q.Test to the TSTDADQ1 queue manager.

runmqsc TSTDADQ1

WebSphere Application Server

You can type the following command to ensure that your QM listener is running.

ps -ef | grep mqlsr

The result will be similar to the image below.

WebSphere Application Server

To create a default channel, you can run the following command.

runmqsc TSTDADQ1

WebSphere Application Server

We can now use a sample MQ program called amqsput which we can use to put and get a test message from a queue to ensure that our MQ configuration is working before we continue to configure WebSphere.

Type the following command to put a test message on the LQ.Test queue:

/opt/mqm/samp/bin/amqsput LQ.TEST TSTDADQ1

Then you can type a test message: Test Message and hit Enter; this will put a message on the LQ.Test queue and will exit you from the AMQSPUTQ command tool.

WebSphere Application Server

Now that we have put a message on the queue, we can read the message by using the MQ Sample command tool called amqsget. Type the following command to get the message you posted earlier:

/opt/mqm/samp/bin/amqsget LQ.TEST TSTDADQ1

The result will be that all messages on the LQ.TEST queue will be listed and then the tool will timeout after a few seconds as shown below.

WebSphere Application Server

We need to do two final steps to complete and that is to add the root user to the mqm group. This is not a standard practice in an enterprise, but we have to do this because our WebSphere installation is running as root. If we did not do this, we would have to reconfigure the user which the WebSphere process is running under and then add the new user to MQ security. To keep things simple, ensure that root is a member of the mqm group, by typing the following command:

usermod -a -G mqm root

We also need to change WMQ security to ensure that all users of the mqm group have access to all the objects of the TSTDADQ1 queue manager. To change WMQ security to give access to all objects in the QM, type the following command:

setmqaut -m TSTDADQ1 -t qmgr -g mqm +all

Now, we are ready to re-continue our configuring WebSphere and create the appropriate QCF and queue destinations to access WMQ from WebSphere.


Please enter your comment!
Please enter your name here