Tuesday, May 24, 2011

MQ on a shoestring - Basic setup

I needed to write an app that connected to an MQSeries queue manager in Chicago and read FIXML messages. I found plenty of posts about connecting and reading messages from MQ but what I needed was the basic setup required to actually connect to a queue manager. Everything I found assumed that all the prerequisite software was installed and I was ready to code.

First task was to identify and download the software. Luckily I had done some prototyping with MQ a couple of years ago. I had version 6.0 so that's what I went with. Navigating the IBM website can be painful at the best of times so I've included the names of the files you need so finding them should be easier.

WebSphere MQ Client
The zip file is named mqc6_win.zip (132MB). Installation was straightforward. Just click through to the end.

Message Service Client for C/C++ and .NET
The zip file is named ia9h.zip (65MB). Again installation was straightforward.

In the IDE I added the following components:


If the references are not available from Add References, the files are located here (based on a default installation):
  • C:\Program Files\IBM\WebSphere MQ\bin\amqmdnet.dll
  • C:\Program Files\IBM\WebSphere MQ\bin\amqmdxcs.dll
  • C:\Program Files\IBM\WebSphere MQ\bin\IBM.XMS.dll

This is the point where all those MQ examples are now possible, or at least within reach. Next we'll determine what information is needed to setup a connection.

Keeping track of SQL Connections

Just about all the applications I write have a database somewhere in the mix. Not only that, a number of the applications are packaged as windows services and run from a dedicated app server. There may be multiple instances of the same service running on multiple servers. With the dozens connections, so which connection belongs to which instance?

When generating the SQL connection I populate the Application section of the connection string. The format I use is App [Thread][App Version]. Keeping track of the thread can be useful when checking a log file



When releasing updated software I find this feature invaluable. It provides a simple method of determining who is using what version of your software. If you are feeling malicious, a right click and a Kill Process can force the user to upgrade.