views:

100

answers:

1

hi, i am looking to set the MQ Header field 'PutApplName' in my java client and access the same in the JMSXAppID field as a JMS header. The documents on the net talk about the MQ Header Fields getting mapped to JMS ones. Has anyone tried this?

+2  A: 

You must be using WMQ v7 at the client and the server to do this in a JMS-portable way. Since v6 is end-of-life next year, you are hopefully already on v7 anyway. In v7 all MQMD properties are accessible using message properties. In v6 it was necessary to drop down into WMQ-specific Java classes and it wasn't pretty.

That said, please take a look at JMS fields and properties with corresponding MQMD fields which maps all the MQMD fields to the corresponding JMS properties.

There is a sample program which writes to MQMD fields and which is installed with the WMQ Client. If you installed the full WMQ client rather than just grabbing the jar files this program will reside at: C:\Program Files\IBM\WebSphere MQ\tools\jms\samples\simple\SimpleMQMDWrite.java

The sample program uses the WMQConstants class rather than coding the string value directly. You can find the WMQConstants documented here. Within the constants you should find JMS_IBM_MQMD_PUTAPPLNAME here. The JavaDoc for this field says:

JMS_IBM_MQMD_PUTAPPLNAME

public static final String JMS_IBM_MQMD_PUTAPPLNAME

JMS_IBM_MQMD_PUTAPPLNAME property name. Sets or gets the MQ application name sending the message. Set using setStringProperty(JmsConstants.JMS_IBM_MQMD_PUTAPPLNAME,); Get using getStringProperty(JmsConstants.JMS_IBM_MQMD_PUTAPPLNAME); Valid on a Message object.

Note that the application must be granted +setall authority either by running in the mqm group (NOT recommended) or by using the setmqaut command. The +setall authorization must be applied both at the QMgr and at the specific queue.

T.Rob
I need to access the MQHeader Object fields esp. 'PutApplName'
hakish
OK, I've expanded the answer to walk you through it.
T.Rob