Watch Out for WebSphere MQ / JMS Compatibility Problems

WebSphere MQ is IBM's message queuing product.  The messages it sends and receives have 2 parts: a fixed format header and a free form body.  JMS is the Java package that creates a standard interface to abstract messaging.  All the JMS programmer knows is that he's talking to some sort of messaging system (such as WebSphere MQ) behind JMS.

One of the features of JMS is the properties collection.  This is a collection of meta-data name/value pairs used to describe the message.  The properties collection is not a feature of WebSphere MQ, so how does WebSphere MQ act as a back end to JMS?  Since the properties can't go into the WebSphere MQ header (there's no place for them), WebSphere MQ puts them into the message body.  And now the compatibility problems begin.

IBM supplies 2 libraries to Microsoft .NET programmers.  WebSphere Classes for .NET supports "classic" WebSphere MQ.  See http://www.redbooks.ibm.com/redbooks/pdfs/sg247012.pdf, chapter 7 for details.  IBM also supplies Message Service Clients for C/C++ and .NET (http://www-128.ibm.com/developerworks/websphere/library/techarticles/0509_phillips/0509_phillips.html), commonly know as XMS.  XMS is an implementation of JMS for Microsoft environments with a WebSphere MQ back end.  Everything works fine when classic WebSphere MQ talks to classic WebSphere MQ or JMS talks to JMS/XMS.

But what happens when a JMS/XMS originator sends a message to a classic WebSphere MQ receiver?  The body of the message does not make sense because it's prepended with the JMS properties (as well as other JMS data).  The situation is especially unpleasant when you're expecting to receive a well formed XML document, something you'll never receive due to the JMS data.  IBM documents this at http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/index.jsp?topic=/com.ibm.mq.csqzaw.doc/csqzaw1481.htm.

What to do?

  1. Understand which type (or types) of messages you need to work with, classic WebSphere MQ or JMS.
  2. Isolate and abstract you queuing code, perhaps into a pluggable module, so that you can easily switch between the two modes of operation.  Note: IBM supplies 2 different libraries; they have completely different APIs.
  3. Don't try to receive both types of messages on the same queue.  A queue should be either all classic WebSphere MQ or all JMS.

Print | posted @ Sunday, October 01, 2006 12:39 PM

Comments on this entry:

No comments posted yet.

Your comment:

Title:
Name:
Email:
Website:
 
Italic Underline Blockquote Hyperlink
 
 
Please add 7 and 1 and type the answer here: