JMS - Java Message Service



How transactional J2EE works in IBM Websphere MQ 5.2.1 / 5.3 / 6.0

In the following will be discussed how a J2EE client connects transactionally to MQ.
There are traditionally the following ways to connect transactionally to MQ: IBM provides and supports com.ibm.mqetclient.jar only!! for MQ v5.3 and v6.0 . It is even not easy to obtain the client for MQ 5.3 because it's not distributed openly. But it can be done (that is... I did it). I've worked a lot with it - and it has always without problems for me.

com.ibm.mqetclient.jar works the same way for MQ v5.3 and v6.0. It basicly just contains the class OSE . When a J2EE application submits a transactional MQ request, then the class com.ibm.mq.MQEnvironment is instantiated. The first thing this class does is trying to dynamicly load the com.ibm.OSE class from com.ibm.mqetclient.jar.

com.ibm.mq.MQEnvironment - looks the same for MQ 5.2.1 / 5.3 / 6.0

package com.ibm.mq;

import com.ibm.mqservices.Trace;
import java.io.*;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.*;
import javax.resource.spi.ConnectionManager;

public class MQEnvironment {
    ...
    static boolean getXaClientEnabled()
    {
        return xaClientEnabled;
    }
    ...
    static boolean xaClientEnabled = false;
    ...
    static {
        try {
            Class.forName("com.ibm.mq.OSE");
            ...
        }
        catch(Exception exception) {
            ...
}   }   }

To situations are possible:

com.ibm.mq.OSE

package com.ibm.mq;

import java.io.*;
import java.util.StringTokenizer;

class OSE {

    ...
    static 
    {
        MQEnvironment.xaClientEnabled = true;
        ...
    }
}



Talk about taking a round-trip! This is the reson why MQ v5.2.1 appears to support transactional MQ clients - even though IBM certainly don't support it. I haven't actually done transactional interfacing - because at the time I came around, it was too old (basicly... I couldn't get a copy to try out).

Sure, the OSE.class does a tiny bit more about checking the OS - enabling MQ to check if you have licence for the setup you're running (basicly checking that the MQ is running on the same kind of platform as the J2EE client).

Since the OSE.class'es are so similar for MQ 5.2.1 / 5.3 / 6.0 it should be possible to use the etclient from 6.0 on 5.3 . Naturally, it's in no way supported by IBM... but hey... it works!

So... basicly... all the transactional support is in the jar-file: com.ibm.mq.jar and available for all MQ versions 5.2.1, 5.3, 6.0 . All the etclient does is enabling xa. And actually, xa-mode may actually be enabled / disabled by any client setting the static variable at any point. However, that would be risky, because just setting the variable would perhaps not get everything else inintialized. But that's another story...