4
votes

I am running Weblogic 10.3 on Linux and I have setup a bridge to Webspere MQ. I am sending a TextMesasge from Weblogic and it is being transfered to MQ. But when I am reading the message on MQ side like

// Receiver reader - my class
reader.qMgr = new MQQueueManager(qManager);
int openOptions = MQOO_INPUT_AS_Q_DEF | MQOO_OUTPUT ;

MQQueue localQueue = reader.qMgr.accessQueue(queueName, openOptions);
MQMessage msg = new MQMessage();
MQGetMessageOptions gmo = new MQGetMessageOptions(); 
localQueue.get(msg, gmo);

int n = msg.getDataLength();
System.out.println("The message is " + n + " bytes long");
String msgText = msg.readStringOfByteLength(n);
System.out.println("The message is: " + msgText);

I am getting:

The message is 154 bytes long The message is: RFH ��MQSTR � jms_text Hqueue:///Q113575850399442 ABCDE

"ABCDE" is my message.

Do I have somehow to instruct Websphere MQ to perform JMS->MQ conversion so the message will be read as simple 'ABCDE'?

Thanks

2
What version of WMQ QMgr and of WMQ client? The specifics of how to get it to do what you want vary by version.T.Rob
I am running WMQ manager 6.0.2. And I compile my client app with the jars that come with this versionAleksandr Broytman

2 Answers

3
votes

The program sending the messages should set the TARGCLIENT parm as described here.

Please bear in mind that all WMQ V6.x is out of support. If you were to use one of the supported versions (all the v7.x) you would be able to set the queue's PROPCTL attribute to cause the QMgr to strip the JMS headers without little or no code changes.

You can get the new version of WMQ through Passport Advantage if your company has a support agreement in place. The new client is available at no charge as SupportPac MQC75. You can mix client and QMgr versions and the new clients have a number of bug fixes and new features (many of which you can use even while connecting to an older QMgr). The newer client and QMgr will also have security patches not present on the V6 code. Please try to get to a supported version at least of the client since its free but preferably of the QMgr as well.

0
votes

If you use the supported JMS API on the WebSphere MQ side, you don't have to perform any conversion to obtain the content of the message.

You can just invoke the javax.jms.TextMessage.getText() method that will return the content of the message (ABCDE).