MQSeries Integration

Hello there, I was wondering if MQEI for MQSeries is supported on Domino 6, because MQSLX isn’t.

Secondly, say I want to pick some information out of a notes database, create an XML message out of it and then put it on a queue. This has to happen on a periodic basis. How would one go about this?. Any comments will be welcome!

Subject: MQSeries Integration

You can fiddle with it a bit in different environments, but this is the rundown from what I remember:

MQ 5.2 + MQLSX + R5 - Supported until 12/31/2004

MQ 5.2 + Java + R5 - Doesn’t work (MQ Java requires JVM 1.3.1 or later; R5 only supports up through 1.1.8).

MQ 5.3 + MQLSX + R5 - Not sure if this is supported, but it does work (see note below about re-installing mqlsx.dll)

MQ 5.3 + MQLSX + D6 - Unsupported, but it works ( you can get the mqlsx.dll file from a 5.2 install and drop it in the …\bin directory of a 5.3 install, and it will work).

MQ 5.3 + Java + D6 - Works and supported.

Subject: RE: MQSeries Integration

Useful run-down! For the record, MQ 5.1 Java and R5 play together.

Subject: MQSeries Integration

OK, I’ve found some code I put together some time back. It’s a bit old – could do with a tweak here and there, and only tested in Notes 5.0.11 – but it works.

It’s a class that encapsulates connecting to a specified MQ queue, with a simple method to return a message as a String object. You may want to modify for some decent logging, and also to work with your Notes application. I’ve annotated some of the bits you might want to change.

import com.ibm.mq.*;

import lotus.domino.*;

/**

  • Encapsulates connection to Websphere MQ & grabs message

  • Returns message as a string. You migh want to change this

  • @author Ben Poole

  • @version 0.10, 26 November 2003

**/

public class MQXMLConnection {

private final String CLASS_NAME = this.getClass().getName();

private String queuefield;



public MQXMLConnection() {

	// Any init code goes in constructor here

}





/**

* Using parameters in the current Lotus Notes database,

* connects to specified MQ host & queue, returning

* message content as String object.

* <p>

* You may want to re-factor so that it's static

*

* @param	db representing current (Notes) Database object

* @return	String containing message from MQ

*/

public String getMessage(Database db) {

	final String SETUP_VIEW = "vwLUSetup";	// your params view

	final int WAIT_INT = 10000;



	String hostName = null;

	String queueName = null;

	String channel = null;

	String queueMgr = null;

	int port = 0;

	String msgText = null;



	try {

		View vwConfig = db.getView(SETUP_VIEW);

		if(vwConfig==null) {

			System.err.println(CLASS_NAME + ": configuration view in Notes application not found.");

			return null;

		}

		Document doc = vwConfig.getFirstDocument();

		int i;

		if(doc != null) {

			// Might want to change these field names

			hostName = doc.getItemValueString("txtHostName");

			channel = doc.getItemValueString("txtChannel");

			queueName = doc.getItemValueString(queuefield);

			queueMgr = doc.getItemValueString("txtQueueMgr");

			port = doc.getItemValueInteger("numPort");

		}



		MQEnvironment.hostname = hostName;

		MQEnvironment.channel = channel;

		MQEnvironment.port = port;

		MQEnvironment.properties.put(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES);



		MQQueueManager qMgr = new MQQueueManager(queueMgr);

		int openOptions = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_OUTPUT;

		MQQueue mqQ = qMgr.accessQueue(queueName, openOptions);

		MQMessage retrievedMsg = new MQMessage();

		MQGetMessageOptions gmo = new MQGetMessageOptions();

		gmo.options = MQC.MQGMO_WAIT | MQC.MQGMO_FAIL_IF_QUIESCING | MQC.MQGMO_NO_SYNCPOINT;

		gmo.waitInterval = WAIT_INT;

		mqQ.get(retrievedMsg,gmo);

		int msgLen = retrievedMsg.getMessageLength();

		msgText = retrievedMsg.readString(msgLen);

		qMgr.commit();

		mqQ.close();

		qMgr.disconnect();

	} catch(NotesException ne) {

		System.err.println(CLASS_NAME + ": Domino exception: " + ne.id +

			" - " + ne.text);

	} catch (MQException mqe) {

		System.err.println(CLASS_NAME + ": MQ exception: " + mqe.completionCode +

			" - " + mqe.reasonCode);

	} catch(Exception e) {

		e.printStackTrace();	// Not proper handling. Sue me ;o)

	}



	return msgText;

}

}

HTH

Subject: RE: MQSeries Integration

Hi,

I did a Lotusscript to Java implementation to replace the existing MQ functionality and it has been working fine for over 14 months with no issues. Worth a look.

Subject: MQSeries Integration

As you say, the MQ LSX is not supported in Notes 6.x. To this end, IBM want you to use Java to integrate with MQ, and that’s not too much of a big deal in 6, given that the JVM was upgraded to 1.3.1 (as opposed to integrating in R5: oh the pain). It would be pretty trivial to generate XML from Notes and pass this out to a queue. There are example Java agents out there which show how this is done. You’ll need the appropriate version of the com.ibm.mq.jar file too:

HTH

Subject: MQSeries Integration

Rishi,

That link Ben posted is pretty useless (Sorry, Ben, your insights are usually top notch, but that link is just pure editorial griping with no real meat) but here is one that will help you immensely as it did for me ==>

It’s a brief tutorial from IBM DeveloperWorks (should take you an hour or so to go through) with sample code you can use from Domino to put a message on a queue and get a message from a queue. It also shows code you can use outside of Notes/Domino. If you’d rather read the tutorial offline, there is a PDF you can download. I highly recommend it. I used the sample to put a message on a queue from a Windows 2000 Server to an IBM mainframe. The mainframe guy confirmed the message arrived and he was able to read it.

Ken

Subject: RE: MQSeries Integration

Insight? Me? ;o)

But seriously, I don’t follow. Why do you say there’s no meat the link? I posted it here as a resource – not a “how-to” – as it contains old (i.e. suitable for use with the R5 JVM) version of the MQ classes for those who need them. You won’t find this version of the package on the IBM site.

Irrelevant for pure 6.x code I agree, but if you’re in a mixed environment, you need it.

So, I’m puzzled. Thanks for the tutorial link though, that’s the one I used, just couldn’t find the link ;o)

Subject: RE: MQSeries Integration

Thanks a lot guys that has been extremely useful