views:

830

answers:

2

Hello, I'm using the JMS API to send messages to a Websphere MQ server. The application that pulls the messages i create want's me to set up the ApplicationID field in the MQMD structure to constant value. I could not find a way in the JMS API to access the MQMD structure

The question: Is there a way doing this? if yes then how? If no, then is my only option is to use the MQ java API, instead of JMS API?

Thanks

A: 

From the MQ documentation:

Where the MQMD includes a field that is equivalent to the JMS field, the JMS field is mapped onto the MQMD field. Additional MQMD fields are exposed as JMS properties, because a JMS application may need to get or set these fields when communicating with a non-JMS application.

The property you are looking for is probably "JMSXAppID".

If that doesn't work, check the documentation. There is a lot of weird stuff like "This section does not apply if an application uses a real-time connection to a broker." (so you don't want a "real-time connection to a broker" ... whatever that may mean).

Also "The administrator indicates that the JMS application is communicating with such an application by setting the TARGCLIENT property of the destination to MQ."

If that doesn't make sense, you must create test cases which help you figure out what MQ is doing behind the scenes. Create a JMS message, set all the properties to some weird values and send that to an inactive MQ queue where you can examine it. This way, you can figure out which field maps where.

After that works, you can try to other way around. If you JMS implementation doesn't allow you to get all properties of a message as a map or something, use the Java debugger to look at the data in memory. Field.setAccessible(true) is your friend.

Aaron Digulla
Thanks, but this is not working. I worte a little applications which uses the MQ API for java which puts hello world messsage into queue and sets the applicationIdData field to some value.. Then i have a MDB which gets the message, and none of the properties in the message have the value i've set.
Alon
A: 

As of v7.0, you can read all the MQMD fields as JMS message properties and can set many of them the same way.

See: http://publib.boulder.ibm.com/infocenter/wmqv7/v7r0/topic/com.ibm.mq.csqzaw.doc/jm41030_.htm

Both the client and the WMQ server must be at v7.0 or higher to use this feature, though.

T.Rob