Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Websphere MQ with JMS from a .NET application

Tags:

c#

.net

jms

ibm-mq

I'm trying to send a message to a java server over a Websphere MQ which uses JMS as the transport protocol. I can happily drop messages on the MQ using the IBM supplied libraries, but the server rejects them. I'm assuming (hopefully correctly) that this is because I'm missing various JMS specific headers/properties on the MQ message.

I have ensured the payloads for the messages are the same by inspecting the queue (they are both map messages if that helps), but don't want to fully implement the JMS Websphere MQ protocol just to get this to work.

I'm wondering if anyone has managed to get this to work, and if so what's the minimum amount of information you need to specify in the JMS header? Are there any alternatives to doing this directly on the MQ (I've seen some about using java interop, but this is something I think would be overkill).

Any help would be greatly appreciated!

like image 954
jonnii Avatar asked Nov 20 '09 15:11

jonnii


People also ask

How does IBM MQ Connect to JMS?

An IBM® MQ classes for JMS application can connect to a queue manager in either client or bindings mode. In client mode, IBM MQ classes for JMS connects to the queue manager over TCP/IP. In bindings mode, IBM MQ classes for JMS connects directly to the queue manager using the Java Native Interface (JNI).

Does IBM MQ use JMS?

From IBM MQ 8.0, the product supports the JMS 2.0 version of the JMS standard. This implementation offers all the features of the classic API but requires fewer interfaces and is simpler to use.

Is IBM MQ JMS compliant?

IBM MQ is both JMS 1.1 and JMS 2.0 specifications compliant. You can configure IBM MQ resources for applications (for example queue connection factories) and manage messages and subscriptions that are associated with JMS destinations in Liberty.


Video Answer


1 Answers

Can you paste the Java code you are using to read the message. Is that code assuming that the message is a "MapMessage". Normally something put into a Queue from a non-java client will appear as either a TextMessage or a BytesMessage.

The WebsphereMQ JMS api is normally fine with reading those messages without the JMS headers as long as you read as a TextMessage / BytesMessage as put.

In my server code, my content is normally put to the queue as bytes, and so appears as a BytesMessage, but just in case i get a message that was manually put on the queue, i catch the classcastexception, and test to see if it is in fact a TextMessage.

like image 131
Tom Sorgie Avatar answered Sep 22 '22 12:09

Tom Sorgie